Solve simplexml_load_string() using simplexml_load_string

  php, soap

After numerous attempts still no success, trying to access this ‘http://www.autobid.co.za/halfway/vehicledetails.php?wsdl , providing the username and password and then gathering the xml feedback. This code :

$client = new SoapClient('http://www.autobid.co.za/halfway/vehicledetails.php?wsdl');
 $result = $client->getVehicleDetails('spwf87','hk8*9jd'); 
 echo('<pre>'.$result.'</pre>');

Dumps the entire text field, want it of course cleaned up as the page source states :

<pre><![CDATA[<VEHICLEDETAILS><VEHICLE><ID....

etc, so tried using:

$client = new SoapClient('http://www.autobid.co.za/halfway/vehicledetails.php?wsdl');

$result = $client->getVehicleDetails('pass','user');
 
$content = simplexml_load_string($result, null,LIBXML_NOCDATA);
$content = simplexml_load_string($content->pre);
$json = json_encode($content);
$content = json_decode($json,TRUE);
var_dump($content);

But still get the error of

Warning: simplexml_load_string(): Entity: line 1: parser error : StartTag: invalid element name in index.php on line 24

Warning: simplexml_load_string(): <![CDATA[<VEHICLEDETAILS><VEHICLE><ID>5002386176</ID><VIN>AHTHA3CD503427515</VIN in index.php on line 24

Warning: simplexml_load_string(): ^ in index.php on line 24

Warning: simplexml_load_string(): Entity: line 1: parser error : Extra content at the end of the document in index.php on line 24

Warning: simplexml_load_string(): <![CDATA[<VEHICLEDETAILS><VEHICLE><ID>5002386176</ID><VIN>AHTHA3CD503427515</VIN in index.php on line 24

Warning: simplexml_load_string(): ^ in index.php on line 24
bool(false)

At my wits end, have to present all the data from the source.

Source: Ask PHP

LEAVE A COMMENT