Reputation: 13
I'm making a SOAP request using php but the response when I print it to the page has unwanted text before and after the returned "html table". Can I filter the results in some way to remove and just leave the html table? The table returned in the results has child tables embedded. All working ok except for unwanted text. Here is my request code
$client = new SoapClient('http://www.q88.com/ws/api.asmx?wsdl');
$q88Search = "Vessel Name";
$params = array("AuthorizationString" => "XXXXXX",
"VesselName" => $q88Search);
$response = $client->__soapCall("GetQ88", array($params));
print_r($response);
The result of this prints
stdClass Object ( [GetQ88Result] =>
to the page before the closing <table>
... and a
} after the </table>
tag. I'm a newbie to SOAP requests so any help is much appreciated.
Upvotes: 0
Views: 1094
Reputation: 351
As per your question, you got a object returns from SOAP client.
So, you can print the desired value from the object returned like :
echo $response->GetQ88Result; //Print the value
The print_r() function is used to print human-readable information about a variable.After you checked the returned value then use the above statement to print the desired value.
Upvotes: 0
Reputation: 897
Donlt use print_r() as this outputs the object. Use
echo response->GetQ88Result;
which will just output the value of GetQ88Result in $response.
Upvotes: 1