当前位置:Gxlcms > PHP教程 > SimpleXMLElement错误,错误讯息httperror503

SimpleXMLElement错误,错误讯息httperror503

时间:2021-07-01 10:21:17 帮助过:45人阅读

在执行pannalesports的api (反正就是一个抓数据的api)
我用 SimpleXMLElement 将数据转成xml的格式 方便我去作截取。但总是在执行一段时间后会出现错误

p.s. 我用curl 先抓下来才转成curl

curl_setopt($httpChannel, CURLOPT_URL, $url);
curl_setopt($httpChannel, CURLOPT_RETURNTRANSFER, true);
curl_setopt($httpChannel, CURLOPT_HTTPHEADER, $IP);
curl_setopt($httpChannel, CURLOPT_HTTPHEADER, $header);
curl_setopt($httpChannel, CURLOPT_SSL_VERIFYPEER, false);
$data = curl_exec($httpChannel);

(这个其实不是重点)

重点是以下的错误讯息
我用try,在SimpleXMLElement错误时,把data和 $e print_r出来如后

Exception Object ( [message:protected] => String could not be parsed as XML [string:private] => [code:protected] => 0 [file:protected] => /home/ns/www/gamble/mlb.php [line:protected] => 66 [trace:private] => Array ( [0] => Array ( [file] => /home/ns/www/gamble/mlb.php [line] => 66 [function] => __construct [class] => SimpleXMLElement [type] => -> [args] => Array ( [0] => ) ) ) ) 2014-10_01 20:02:12

Exception Object ( [message:protected] => String could not be parsed as XML [string:private] => [code:protected] => 0 [file:protected] => /home/ns/www/gamble/mlb.php [line:protected] => 66 [trace:private] => Array ( [0] => Array ( [file] => /home/ns/www/gamble/mlb.php [line] => 66 [function] => __construct [class] => SimpleXMLElement [type] => -> [args] => Array ( [0] => ) ) ) ) Warning: SimpleXMLElement::__construct(): Entity: line 1: parser error : Space required after the Public Identifier in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): ^ in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): Entity: line 6: parser error : Opening and ending tag mismatch: hr line 5 and BODY in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): ^ in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): Entity: line 6: parser error : Opening and ending tag mismatch: BODY line 4 and HTML in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): ^ in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): Entity: line 7: parser error : Premature end of data in tag HEAD line 2 in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): ^ in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): Entity: line 7: parser error : Premature end of data in tag HTML line 2 in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): ^ in /home/ns/www/gamble/mlb.php on line 66 

$e 错误如下

Service Unavailable
HTTP Error 503. The service is unavailable.

有没有解除或debug的方式?

回复内容:

在执行pannalesports的api (反正就是一个抓数据的api)
我用 SimpleXMLElement 将数据转成xml的格式 方便我去作截取。但总是在执行一段时间后会出现错误

p.s. 我用curl 先抓下来才转成curl

curl_setopt($httpChannel, CURLOPT_URL, $url);
curl_setopt($httpChannel, CURLOPT_RETURNTRANSFER, true);
curl_setopt($httpChannel, CURLOPT_HTTPHEADER, $IP);
curl_setopt($httpChannel, CURLOPT_HTTPHEADER, $header);
curl_setopt($httpChannel, CURLOPT_SSL_VERIFYPEER, false);
$data = curl_exec($httpChannel);

(这个其实不是重点)

重点是以下的错误讯息
我用try,在SimpleXMLElement错误时,把data和 $e print_r出来如后

Exception Object ( [message:protected] => String could not be parsed as XML [string:private] => [code:protected] => 0 [file:protected] => /home/ns/www/gamble/mlb.php [line:protected] => 66 [trace:private] => Array ( [0] => Array ( [file] => /home/ns/www/gamble/mlb.php [line] => 66 [function] => __construct [class] => SimpleXMLElement [type] => -> [args] => Array ( [0] => ) ) ) ) 2014-10_01 20:02:12

Exception Object ( [message:protected] => String could not be parsed as XML [string:private] => [code:protected] => 0 [file:protected] => /home/ns/www/gamble/mlb.php [line:protected] => 66 [trace:private] => Array ( [0] => Array ( [file] => /home/ns/www/gamble/mlb.php [line] => 66 [function] => __construct [class] => SimpleXMLElement [type] => -> [args] => Array ( [0] => ) ) ) ) Warning: SimpleXMLElement::__construct(): Entity: line 1: parser error : Space required after the Public Identifier in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): ^ in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): Entity: line 6: parser error : Opening and ending tag mismatch: hr line 5 and BODY in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): ^ in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): Entity: line 6: parser error : Opening and ending tag mismatch: BODY line 4 and HTML in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): ^ in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): Entity: line 7: parser error : Premature end of data in tag HEAD line 2 in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): ^ in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): Entity: line 7: parser error : Premature end of data in tag HTML line 2 in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): in /home/ns/www/gamble/mlb.php on line 66 Warning: SimpleXMLElement::__construct(): ^ in /home/ns/www/gamble/mlb.php on line 66 

$e 错误如下

Service Unavailable
HTTP Error 503. The service is unavailable.

有没有解除或debug的方式?

HTTP错误503是服务器内部错误。

人气教程排行