This is the cURL setup I am using:
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, 'url to xml file');
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT,400);
curl_setopt($ch, CURLOPT_HEADER, 0);
// $output contains the output string
$output = curl_exec($ch);
// close curl resource to free up system resources
curl_close($ch);
And for some reason I get the following error:
[error] [php] simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found (/path/to/rendered/file/file.php
When I call the xml url in the browser I get valid xml so what is causing this error?
Kind regards,
Pim
答案 0 :(得分:0)
You should check $output variable contents. Just do:
echo $output;
and make sure it has your XML document. Generally if some error has occurred cURL will return you a document containing the error and thus you would be able to see why it fails.
Also using curl_errno() function makes sense: it should be 0 if everything is OK with request.