Jump to content

Curl xml response object settype


quasiman

Recommended Posts

Hi all,

 

I'm using curl to post some data, and the response is (assuming no errors) either <boolean>true</boolean> or <boolean>false</boolean>.  So if I use simplexml_load_string, the result is returned as an object.  I'm trying to make this a boolean so I can handle the response, but it doesn't seem to be working....checking for false didn't stop anything from happening.  Here's the problem code:

 

$result = curl_exec($ch);
$xml = settype(simplexml_load_string($result),"boolean");
if (curl_errno($ch) || $xml === false) {
throw new Exception(curl_error($ch));
}

Link to comment
https://forums.phpfreaks.com/topic/246224-curl-xml-response-object-settype/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.