我有以下代码,但通常会缩短响应并且无法解析XML。有办法解决吗?
do {
curl_multi_exec($mh, $running);
curl_multi_select($mh);
} while ($running > 0);
$ebayResponse = curl_multi_getcontent($ebayRequest);
curl_multi_remove_handle($mh, $ebayRequest); //close the handles
try {
$ebay = simplexml_load_string($ebayResponse);
} catch (yii\base\ErrorException $e) {
Yii::error("Could not parse EBay XML response. $e");
Yii::error("Could not parse EBay XML response, \$ebayResponse: $ebayResponse");
我在日志中看到了很多这样的错误
Could not parse EBay XML response. exception 'yii\base\ErrorException' with message 'simplexml_load_string(): Entity: line 1: parser error : Couldn't find end of Start Tag tim line 1' in /app/controllers/ShoppingController.php:97 Context
Could not parse EBay XML response. exception 'yii\base\ErrorException' with message 'simplexml_load_string(): Entity: line 1: parser error : Premature end of data in tag shippingType line 1' in /app/controllers/ShoppingController.php:97 Context
好的,我添加了更多日志记录,这是来自Ebay的完整回复:http://pastie.org/private/wrucbjdaftuusskbzlzwq。请注意,最后一个标记未关闭,因此响应将以某种方式被截断。