title: how to parse xml response and assign to a variable using CURL in php
body: <p>i am hitting a URL/API in browser and getting below xml response from the server.</p>
  
  <pre><code>&lt;test xmlns:taxInfoDto="com.message.TaxInformationDto"&gt;
  &lt;response&gt;
   &lt;code&gt;0000&lt;/code&gt;
   &lt;description&gt;SUCCESS&lt;/description&gt;
  &lt;/response&gt;
  &lt;accounts&gt;
   &lt;account currency="BDT" accAlias="6553720"&gt;
   &lt;currentBalance&gt;856.13&lt;/currentBalance&gt;
   &lt;availableBalance&gt;856.13&lt;/availableBalance&gt;
   &lt;/account&gt;
  &lt;/accounts&gt;
  &lt;transaction&gt;
   &lt;principalAmount&gt;0&lt;/principalAmount&gt;
   &lt;feeAmount&gt;0.00&lt;/feeAmount&gt;
   &lt;transactionRef&gt;2570277672&lt;/transactionRef&gt;
   &lt;externalRef/&gt;
   &lt;dateTime&gt;09/03/2016&lt;/dateTime&gt;
   &lt;userName&gt;01823074838&lt;/userName&gt;
   &lt;taxInformation totalAmount="0.00"/&gt;
   &lt;additionalData/&gt;
   &lt;/transaction&gt;
  &lt;/test&gt;
  </code></pre>
  
  <p>Now i want to parse this xml response and assign it to a variable so that i can use this variable value in anywhere.i am using below PHP code.</p>
  
  <pre><code>&lt;?php
  $ch = curl_init();
  
  // set URL and other appropriate options
  curl_setopt($ch, CURLOPT_URL, "http://x.x.x.x:/ussd/process?     destination=BANGLA&amp;userName=&amp;secondarySource=01");
  curl_setopt($ch, CURLOPT_HEADER, 0);
  $retValue = curl_exec($ch);
  return $retValue;
  ?&gt;
  </code></pre>
  
  <p>and i am getting below output.</p>
  
  <pre><code>0000SUCCESS856.13 856.13 00.00257027770913/03/201601823074838
  </code></pre>
  
  <p>Can anyone please help me how can i parse each value and assign it to a variable.</p>