Parse soap response via curl

Hi Guys,

I am using curl to connect a 3rd party web service and I am getting the correct response.The problem is I can’t parse the response into an array and then get the string.

curl code

$ch = curl_init();						
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);			
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_USERPWD, $soapUser.":".$soapPassword); // username and password - declared at the top of the doc
            curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
            curl_setopt($ch, CURLOPT_TIMEOUT, 10);
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); // the SOAP request
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

            // converting
            $response = curl_exec($ch); 

the response is

<env:Envelope>
     <env:Header/>
              <env:Body>
                      <ns2:getCriteriaResponse>
                               <ns2:standardCriteriaWithLovs>
                                          <adLanguages>
                                                   <language>
                                                             <label>English (UK)</label>
                                                               <value>UK</value>
                                                  </language>
                                          </adLanguages>
                               </ns2:standardCriteriaWithLovs>
                      </ns2:getCriteriaResponse>
               </env:Body>
</env:Envelope>

How can get that language code that is English (UK) and the value UK in an array.

Please help.Thanks in advance.

SimpleXML: http://www.php.net/manual/en/simplexml.examples-basic.php

and another option: http://stackoverflow.com/questions/6578832/how-to-convert-xml-into-array-in-php

@bbolte Many thanks for the link.I have seen that before.But the problem is that in my case the xml file is not generating and the response body which I can see (from firebug > net panel) is inside my question. Somehow it is not a proper xml I guess.When I do print_r($response) it just prints the html in the browser.

sorry, missed the SOAP stuff. Look into NuSOAP.