parser error : Start tag expected, '<' not found

后端 未结 4 690
攒了一身酷
攒了一身酷 2020-12-19 00:46

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         


        
相关标签:
4条回答
  • 2020-12-19 00:57

    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.

    0 讨论(0)
  • 2020-12-19 01:01
    $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); 
    }
    
    0 讨论(0)
  • 2020-12-19 01:17

    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.

    0 讨论(0)
  • 2020-12-19 01:24

    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

    0 讨论(0)
提交回复
热议问题