How to assign result fro curl to a variable?
I need to do a simple POST request and parse the result. For this i use
curl in php. The problem is that i cant assign the result to a variable -
it just prints .
My method:
private function sendRequest($data)
{
$ch = curl_init(self::IP . ':' . self::PORT);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($ch);
curl_close($ch);
$parsed_result = @simplexml_load_string(trim($result)); // HERE IT PRINTS
die(var_dump(isset($parsed_result->request_error)));
if (isset($parsed_result->request_error))
$this->AJAXResult(TRUE, (string)
$parsed_result->request_error->text);
}
No comments:
Post a Comment