I am getting response as xml from curl request. so i am sending these into an array. but after execution of code i am getting this warning
1)Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Start tag expected, '<' not found in C:\wamp\www\newlivebackup\admin\subscribers.php on line 65

2)Warning: simplexml_load_string() [function.simplexml-load-string]: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx in C:\wamp\www\newlivebackup\admin\subscribers.php on line 65

3)Warning: simplexml_load_string() [function.simplexml-load-string]: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx in C:\wamp\www\newlivebackup\admin\subscribers.php on line 65

Here is my code

$ch = curl_init();
  curl_setopt($ch, CURLOPT_URL,"http://url");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
  curl_setopt($ch, CURLOPT_HTTPHEADER,  array("Content-Type: application/x-www-form-urlencoded",  "Content-Length: " . strlen($req)));
  curl_setopt($ch, CURLOPT_HEADER , 0);  

  curl_setopt($ch, CURLOPT_VERBOSE, 1);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
  curl_setopt($ch, CURLOPT_TIMEOUT, 30);

  $curl_result = @curl_exec($ch);
  $curl_err = curl_error($ch);

//echo $curl_result;exit;
    // parse the data
    $curl_result = trim($curl_result);
$xml = (array) simplexml_load_string($curl_result);
5 Years
Discussion Span
Last Post by veedeoo

thanks for your reply.

i obsorb one thing in my code. the curl response

$curl_result = trim($curl_result);
$xml = (array) simplexml_load_string($curl_result);

instead of this i copied this response in a static file and then executed like below it is working fine.
$xml = (array) simplexml_load_string($curl_xml);

so why it is not working

$curl_result = trim($curl_result);
$xml = (array) simplexml_load_string($curl_result);

Please tell me where the problem. actually the response is in valid xml format. is there any chance to save this response in one file. then i will execute. so how to save curl response in text file?



Just to clear some of my doubts, can you run this script on your wamp server


Did you see anything on the screen?

NO? Run

 <? phpinfo(); ?>

Look for your server loaded configuration file .. e.g. apache/bin/php.ini OR php/php.ini.. based on the loaded configuration file, find the php.ini file, load the php.ini file on your editor and then find


Change it to


Go to your wampp/php/ extension directory and double check if the php_curl.dll is present... if not, go and check the wampp website on how to enabled and add extension on their distros..

I am not sure if you can trim cURL output.. coming from the exec handler... I need to read about that..The output is already known by your server to be an array. So adding (array) might be an overkill..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.