title: He!p with SimpleXML for $response in PHP
body: <p>I am sending a XML to a webserver using PHP, and the server returns an XML response. I need help parsing values from the response! I have read the SimpleXML instructions, but my understanding is that all those are only for when XML data is already created, but needs to be parsed. This is my PHP script so far:</p>
  
  <pre><code>&lt;?php
  $ch = curl_init("http://api.online-convert.com/queue-insert");
  $count = $_POST['count'];
  $file = "testdoc2.txt";
  $fh = fopen( $file, 'w' );
  $carriageReturn = "\n";
  fwrite( $fh, $count );
  fclose( $fh );
  
  $request["queue"] = file_get_contents($count);
  curl_setopt($ch, CURLOPT_HEADER, 0);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
  $response = curl_exec($ch);
  curl_close ($ch);
  echo $response;
  
  $xmlstr = simplexml_load_string($response);
  
  $file = "testdoc.txt";
  $fh = fopen( $file, 'w' );
  $carriageReturn = "\n";
  fwrite( $fh, $xmlstr);
  fclose( $fh );
  
  
  ?&gt;
  </code></pre>
  
  <p>The XML response that needs to be parsed is this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;queue-answer&gt;
    &lt;status&gt;
      &lt;code&gt;0&lt;/code&gt;
      &lt;message&gt;Successfully inserted job into queue.&lt;/message&gt;
    &lt;/status&gt;
    &lt;params&gt;
      &lt;downloadUrl&gt;http://www.online-convert.com/result/35f6ddbcc2ca58e7e98addc7c2efd6eb&lt;/downloadUrl&gt;
      &lt;hash&gt;35f6ddbcc2ca58e7e98addc7c2efd6eb&lt;/hash&gt;
    &lt;/params&gt;
  &lt;/queue-answer&gt;
  </code></pre>
  
  <p>I just need to extract the  value and show it to the user. I am an iPhone developer.</p>