I am using PHP for the first time. I am using the php sample for uploading image on ebay sandbox. I am getting the following error on running the PHP file:
P
In my case. I just removed the invisible character The BOM in the beginning of the XML file. How to do it - depends on your text editor.
$hasError = false;
if ( $resp == 'Internal Server Error' || empty($resp) )
{
$hasError = true;
}
if ( ! $hasError )
{
$aux = !empty($resp) ? explode('', $resp) : NULL;
$temp = utf8_decode(trim($aux[0]));
$xml = simplexml_load_string($temp);
}
The code you refer to has this line:
//curl_setopt($connection, CURLOPT_HEADER, 1 ); // Uncomment these for debugging
it seems like you uncommented these. This will result in getting the HTTP header in your response. Which is OK for debugging, but it will create an XML parse error in simplexml_load_string
.
Either comment it out again or put 0
as its value.
Do a var_dump($respXmlStr);
my guess is that this string is not valid XML.
As per the simplexml-load-string documentation, the first parameter is expected to be A well-formed XML string
- http://php.net/manual/en/function.simplexml-load-string.php