fopen()需要十秒钟或更长时间才能回来...... [英] fopen() taking ten seconds or more to come back...

查看:146
本文介绍了fopen()需要十秒钟或更长时间才能回来......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几个月来我一直在使用...


$ fp = fopen(" http://www.weather.gov/data/current_obs/KPKB.xml" ;,r);


....打开xml文件,然后我解析它以提取当地的

天气数据,以及它起作用了。


最近,该页面已经开始挂起,并且通过阻止

部分代码并计时我追踪的不同部分延迟

到fopen()语句。


脚本几乎是瞬间从我的本地驱动器运行,

访问远程网址,但需要10秒或11秒,

来自网络。


我怀疑我的网络提供商发生了变化,但他们是

仍在运行PHP 4.3.1并且allow_url_fopen已开启& on。


有什么想法吗?

Mike Soja

解决方案

< blockquote> fp = fopen(" http://www.weather.gov/data/current_obs/KPKB.xml"," r");


.... to打开xml文件,然后我解析它以提取当地的

天气数据,并且它已经起作用了。


最近,页面已经开始挂起,并通过阻止

部分代码和计时不同部分,我已经跟踪了该fopen()声明的延迟




脚本几乎立即从我的本地驱动器运行,

访问远程URL,但从网络上持续需要10或11秒,

。 />

我怀疑我的网络提供商发生了一些变化,但是他们仍然在运行PHP 4.3.1并且allow_url_fopen打开了&bbsp; on。


有什么想法吗?

Mike Soja


MikeSoja写道:< blockquote class =post_quotes>


fp = fopen(" http://www.weather.gov/data/current_obs/KPKB.xml"," r"); <我怀疑我的网络提供商发生了什么变化




也许weather.gov阻止/制止他们的IP号码。


-

E. Dronkert


For months I''ve been using...

$fp = fopen("http://www.weather.gov/data/current_obs/KPKB.xml","r");

.... to open the xml file, which I then parse to extract the local
weather data, and it has worked swell.

Just lately, the page has started hanging, and by blocking off
sections of code and timing different sections I''ve traced the delay
to that fopen() statement.

The script runs nearly instantaneously from my local drive,
accessing the remote URL, but takes ten or eleven seconds,
consistently, from the web.

I suspected something changed with my web provider, but they''re
still running PHP 4.3.1 and allow_url_fopen is on & on.

Any ideas?
Mike Soja

解决方案

fp = fopen("http://www.weather.gov/data/current_obs/KPKB.xml","r");

.... to open the xml file, which I then parse to extract the local
weather data, and it has worked swell.

Just lately, the page has started hanging, and by blocking off
sections of code and timing different sections I''ve traced the delay
to that fopen() statement.

The script runs nearly instantaneously from my local drive,
accessing the remote URL, but takes ten or eleven seconds,
consistently, from the web.

I suspected something changed with my web provider, but they''re
still running PHP 4.3.1 and allow_url_fopen is on & on.

Any ideas?
Mike Soja


MikeSoja wrote:


fp = fopen("http://www.weather.gov/data/current_obs/KPKB.xml","r");
I suspected something changed with my web provider



Maybe weather.gov is blocking/putting a brake on their ip no.

--
E. Dronkert


这篇关于fopen()需要十秒钟或更长时间才能回来......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆