php中的XML解析:Simple_xml_loadfile函数永远运行

php中的XML解析:Simple_xml_loadfile函数永远运行

问题描述:

I am having a problem with parsing an API which was working fine till yesterday!

The code snippet :

$checkurl = "http://api1.webpurify.com/services/rest/?method=webpurify.live.check&api_key=&text=".urlencode('test test test');

$response = simplexml_load_file($checkurl,'SimpleXMLElement', LIBXML_NOCDATA);

The problem is simplexml_load_file() is not returning any value and loads forever!

我在解析直到昨天工作正常的API时遇到问题! p>

代码段: p>

  $ checkurl =“http://api1.webpurify.com/services/rest/?method=  webpurify.live.check& api_key =& text =“。urlencode('test test test'); 
 
 $ response = simplexml_load_file($ checkurl,'SimpleXMLElement',LIBXML_NOCDATA); 
  code>   pre> 
 
 

问题是 simplexml_load_file() code>没有返回任何值并永远加载! p> div>

This is not a SimpleXML problem, but most likely occurs because the download is being blocked somehow.

Open up your browser and try to access the URL first; if you can download the file properly, save it and run it through SimpleXML again. That would eliminate at least one factor.