Manually convert XML SOAP response into PHP array -


i'm trying convert xml soap response php array, here xml soap response:

string(1182) "<auctionlist isvalid="true" totalrecords="90">                 <auction id="112906125" name="softwaresystems.co" traffic="0" bidcount="0" price="$11 usd" valuationprice="-" timeleft="17m 9s" rowid="1"/>                 <auction id="112557715" name="softwareintec.info" traffic="0" bidcount="0" price="$8 usd" valuationprice="-" timeleft="18m 9s" rowid="2"/>                 <auction id="101835614" name="softwareruleta.com" traffic="20" bidcount="0" price="$25 usd" valuationprice="-" timeleft="24m 9s" rowid="3"/>                 <auction id="112573759" name="softwareintec.com" traffic="2" bidcount="0" price="$5 usd" valuationprice="-" timeleft="28m 9s" rowid="4"/>                 <auction id="112648957" name="softwareassetmanagementjobs.com" traffic="7" bidcount="0" price="$8 usd" valuationprice="-" timeleft="41m 9s" rowid="5"/>             </auctionlist>"  

this response result of godaddy auction api domain details.

i have tried parse string getting errors:

warning: simplexml_load_string(): namespace warning : xmlns: uri gdauctionsbiddingwsapi not absolute in c:\xampp\htdocs\adam_auction\index.php on line 94  warning: simplexml_load_string(): w.w3.org/2001/xmlschema"><getauctionlist2response xmlns="gdauctionsbiddingwsapi" in c:\xampp\htdocs\adam_auction\index.php on line 94  warning: simplexml_load_string(): ^ in c:\xampp\htdocs\adam_auction\index.php on line 94 object(simplexmlelement)#1 (1) { ["getauctionlist2response"]=> object(simplexmlelement)#2 (1) { ["getauctionlist2result"]=> string(768) "" } } 

any how convert response php array?

try this

<?php  $xml = simplexml_load_string(your xml response);  $auction = $xml->auction; foreach($auction $auc) { $short_name[] =  $auc['name'];   } echo "<pre>"; print_r($short_name);  ?> 

output

array (     [0] => simplexmlelement object         (             [0] => softwaresystems.co         )      [1] => simplexmlelement object         (             [0] => softwareintec.info         )      [2] => simplexmlelement object         (             [0] => softwareruleta.com         )      [3] => simplexmlelement object         (             [0] => softwareintec.com         )      [4] => simplexmlelement object         (             [0] => softwareassetmanagementjobs.com         )  ) 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -