$response = curl_exec($ch);
curl_close($ch);
dd($response);
It is of type response string.
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ns3:GetProductListResponse xmlns:ns3="http://xxx1">
<result>
<status>success</status>
</result>
<products>
<product>
<currencyAmount>900.00</currencyAmount>
<currencyType>1</currencyType>
<displayPrice>900.00</displayPrice>
<isDomestic>false</isDomestic>
<id>557830715</id>
<price>900.00</price>
<productSellerCode>TSRT7777</productSellerCode>
<approvalStatus>6</approvalStatus>
...
To convert this data to xml I used simplexml_load_string()
$response = curl_exec($ch);
curl_close($ch);
$xml = simplexml_load_string($response);
dd($xml);
And the output is like this.
^ SimpleXMLElement {#435}
I'm trying to access the data in it and try this.
$status = (string)$xml->result->status;
dd($status);
Returns :
^ ""
I tried using simplexml_load_file() and got no results. My main goal is to get this data as json, but I can't do it because I can't read the values.Any help would be great. Thanks in advance.
After @Jacob Mulquin's suggestion I used:
if ($xml === false) {
dump("b");
foreach (libxml_get_errors() as $error) {
dump($error->message);
}
dd("a");
} else {
dd("c");
}
Returned : "c"