简体   繁体   中英

php simple xml file gives timeout but site is fine

I am having a weird problem... I use simpleXML_load_file to parse a news site. It worked fine until yesterday, now, for some reason it gives timeout, but the site is fine(you can navigate to it through a browser.

I have the same code in several servers and none of them is working.

Could it be that the site I parse make some change?

Use a wrapper of curl to retrieve the result first, and then load to simpleXML. This will allow you to write in retries a little better than doing retries on simpleXML_load_file.

It's not likely, but they could have blocked requests from certain client types (CURL) from your IP or all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM