Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
706 views
in Technique[技术] by (71.8m points)

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

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:

PHP Warning:  simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found in /home/nish/stuff/market place/test/php5/UploadImage/UploadSiteHostedPictures.php on line 69
PHP Warning:  simplexml_load_string(): HTTP/1.1 200 OK in /home/nish/stuff/market place/test/php5/UploadImage/UploadSiteHostedPictures.php on line 69
PHP Warning:  simplexml_load_string(): ^ in /home/nish/stuff/market place/test/php5/UploadImage/UploadSiteHostedPictures.php on line 69
PHP Notice:  Trying to get property of non-object in /home/nish/stuff/market place/test/php5/UploadImage/UploadSiteHostedPictures.php on line 92
PHP Notice:  Trying to get property of non-object in /home/nish/stuff/market place/test/php5/UploadImage/UploadSiteHostedPictures.php on line 93
PHP Notice:  Trying to get property of non-object in /home/nish/stuff/market place/test/php5/UploadImage/UploadSiteHostedPictures.php on line 93
PHP Notice:  Trying to get property of non-object in /home/nish/stuff/market place/test/php5/UploadImage/UploadSiteHostedPictures.php on line 94
PHP Notice:  Trying to get property of non-object in /home/nish/stuff/market place/test/php5/UploadImage/UploadSiteHostedPictures.php on line 94

Relevant lines are:

69. $respXmlObj = simplexml_load_string($respXmlStr);     // create SimpleXML object from string for easier parsing
                                                      // need SimpleXML library loaded for this

92. $ack        = $respXmlObj->Ack;
93. $picNameOut = $respXmlObj->SiteHostedPictureDetails->PictureName;
94. $picURL     = $respXmlObj->SiteHostedPictureDetails->FullURL;

What I can understand is the respXMLObj is not getting set properly. I have checked that simleXML support is enabled.

Could someone please help me debug this. Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...