title: How do I capture XML out in PHP
body: <p>I am using a sms gateway i.e. sms4connect. Sms are sending successfully. Now the problem is I want to save the sms sending results into my table and then fetch the results.</p>
  
  <p>Here is my php code :</p>
  
  <pre><code>&lt;?php
  
  $num = "92xxxxxxxxxx";
  $mes = "Hello World (&amp;) and a 5 note"; 
  
  // Configuration variables 
  $type = "xml"; 
  $id = "myid"; 
  $pass = "mypass"; 
  $lang = "English"; 
  $mask = "mymask"; 
  
  // Data for text message 
  $to = $num ; 
  $message = $mes; 
  $message = urlencode($message);   
  
  // Prepare data for POST request
   $data = "id=".$id."&amp;pass=".$pass."&amp;msg=".$message."&amp;to=".$to."&amp;lang=".$lang."&amp;mask=".$mask."&amp;type=".$type;   
  
   // Send the POST request with cURL 
   $ch = curl_init('http://www.sms4connect.com/api/sendsms.php/sendsms/url'); 
   curl_setopt($ch, CURLOPT_POST, true); 
   curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
   $result = curl_exec($ch); //This is the result from SMS4CONNECT curl_close($ch);
   echo $result;
  $query = mysql_query("INSERT INTO sms_response (phone, msg) values('$to','$result')");
  
  ?&gt;
  </code></pre>
  
  <p>and I am getting the message "(300 Success Message Sent to Telecom. 239133150)". I want to save this message against each number into my database table. As you see in my PHP code that I am inserting $to, $result values in sms_response table but instead of saving number and message, I am getting these values in my table as shown in the image.
  <a href="https://i.stack.imgur.com/QXXlc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QXXlc.png" alt="enter image description here"></a></p>
  
  <p>So How can I save message and Phone into my table correctly. Help would be highly appreciable.</p>