php - simplexml_load_string() just storing string of xml issue -



php - simplexml_load_string() just storing string of xml issue -

i've been frustrated day issue, have say. website i'm working on utilises rest based api receive company data. using curl, have xml request , response coming me okay.

however, 1 time seek utilize simplexml_load_string() alter xml array, stores xml string within 1 index of array. below, can see code along print screen of how array looks in google chrome's developer tools.

code:

$ch = curl_init($url); curl_setopt($ch, curlopt_ssl_verifyhost, 0); curl_setopt($ch, curlopt_ssl_verifypeer, 0); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, "requestxmlstr={$xml_data}"); curl_setopt($ch, curlopt_returntransfer, 1); $output = curl_exec($ch); curl_close($ch); $searchresults = simplexml_load_string($output); exit(print_r($searchresults));

the exit(print_r($searchresults)) displays next on page:

simplexmlelement object ( [0] => 24/06/2014 15:47:38 companysearch uk 6.0 www.creditsafe.com 1 1 1 25 psr design limited 08821170 uk hazlemere 70 chorley new road bolton lancashire bl1 4by none filed active - newly incorporated ) 1

below how looks in google developer tools:

http://i59.tinypic.com/30k36af.png

any ideas?

found issue myself. turns out returned xml string using html entities , stupidly didn't realise. ran xml string through html_entity_decode() before running through simplexml_load_string() , worked fine.

php xml curl

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -