473,320 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

fopen() taking ten seconds or more to come back...

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

Oct 18 '05 #1
10 2200
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
Oct 18 '05 #2
On Tue, 18 Oct 2005 14:23:31 +0200, Ewoud Dronkert
<fi*******@lastname.net.invalid> posted:
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.


It comes right back from my local hard drive.
Mike Soja

Oct 18 '05 #3
On Tue, 18 Oct 2005 14:23:31 +0200, Ewoud Dronkert
<fi*******@lastname.net.invalid> posted:
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.


Or, rather, I should say, it comes right back *to* the fopen() when
I run it from my local hard drive. The delay only occurs when
fopen() runs from the web site.

And I only read from weather.gov once an hour, keeping a local copy
of the file between times, so I'm not hitting them up too often.

Mike Soja
Oct 18 '05 #4
MikeSoja wrote:
The delay only occurs when fopen() runs from the web site.
I understood, that's why I suggested that weather.gov might be blocking
*their* ip address.
And I only read from weather.gov once an hour, keeping a local copy
of the file between times, so I'm not hitting them up too often.


...but probably not then.

--
E. Dronkert
Oct 18 '05 #5
>> The delay only occurs when fopen() runs from the web site.

I understood, that's why I suggested that weather.gov might be blocking
*their* ip address.
And I only read from weather.gov once an hour, keeping a local copy
of the file between times, so I'm not hitting them up too often.


..but probably not then.


Unless this hosted site isn't the *only* site hitting weather.gov from
that IP address. You have to worry about what your neighbors on the
same box are doing.

Also, it could be that the net is just saturated for that machine's
connection to the outside world.

Gordon L. Burditt

Oct 18 '05 #6
$fp = fopen("http://www.weather.gov/data/current_obs/KPKB.xml","r");


Does the delay still occur at your site if you substitute the IP:

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

If not, then your host's DNS or some similar network-related issue is
causing the delay.

---
Steve

Oct 18 '05 #7
On Tue, 18 Oct 2005 16:04:51 +0200, Ewoud Dronkert
<fi*******@lastname.net.invalid> posted:
MikeSoja wrote:
On Tue, 18 Oct 2005 14:23:31 +0200, Ewoud Dronkert
<fi*******@lastname.net.invalid> posted:
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.
The delay only occurs when fopen() runs from the web site. I understood, that's why I suggested that weather.gov might be blocking
*their* ip address.
Ah, so. My mistake. I assigned the possessive to the closest noun,
not the correct one.

I suppose there's no way to find out, outside of badgering the
respective parties.
And I only read from weather.gov once an hour, keeping a local copy
of the file between times, so I'm not hitting them up too often.

..but probably not then.


As it is, the delay affects only the first page access every hour,
so it's just a niggling problem, and something apparently beyond the
scope of my script.

Mike Soja

Oct 21 '05 #8
On 18 Oct 2005 09:31:03 -0700, "Steve" <go********@nastysoft.com>
posted:
$fp = fopen("http://www.weather.gov/data/current_obs/KPKB.xml","r");
Does the delay still occur at your site if you substitute the IP: $fp = fopen("http://81.22.33.120/data/current_obs/KPKB.xml","r"); If not, then your host's DNS or some similar network-related issue is
causing the delay.


No delay on that one, just a big, fat 404.

"Warning: fopen(http://81.22.33.120/data/current_obs/KPKB.xml)
[function.fopen]: failed to create stream: HTTP request failed!
HTTP/1.0 404 Not Found"
I'm afraid I don't understand how using an incorrect address tells
me anything, though.

Mike Soja

Oct 21 '05 #9

Does the delay still occur at your site if you substitute the IP:
$fp = fopen("http://81.22.33.120/data/current_obs/KPKB.xml","r");

If not, then your host's DNS or some similar network-related issue is
causing the delay.


No delay on that one, just a big, fat 404.

I'm afraid I don't understand how using an incorrect address tells
me anything, though.


That was a regrettable typo (looks like my DNS is screwed up too!
Although it doesn't help that weather.gov is an alias) Please try with:

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

When I use this IP I get the same XML resultset as when using
www.weather.gov.

---
Steve

Oct 21 '05 #10
On 21 Oct 2005 05:50:57 -0700, "Steve" <go********@nastysoft.com>
posted:
>Does the delay still occur at your site if you substitute the IP: > $fp = fopen("http://81.22.33.120/data/current_obs/KPKB.xml","r"); >If not, then your host's DNS or some similar network-related issue is
>causing the delay.
No delay on that one, just a big, fat 404. I'm afraid I don't understand how using an incorrect address tells
me anything, though.
That was a regrettable typo (looks like my DNS is screwed up too!
Although it doesn't help that weather.gov is an alias) Please try with: $fp = fopen("http://140.90.113.195/data/current_obs/KPKB.xml","r"); When I use this IP I get the same XML resultset as when using
www.weather.gov.


That's much better, thanks.

And the delay goes away!!!

And, as you say, the resultset is the same, and therefore, the rest
of my script continues to work.

Thanks.

Mike Soja

Oct 21 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ming | last post by:
When I use fopen on the URL: fopen("http://home.pchome.com.tw/world/qoo4ko/110.jpg";, "r") I would get the following error message: -----------Error Message------------ Warning: fopen():...
7
by: John | last post by:
I can write to this textfile: $fp = fopen("./testfile.txt","w"); but not this html file: $fp = fopen("./testfile.html","w"); How do I get permission to write to a html file?
2
by: ggg | last post by:
Here's what I'm trying to do. The server serves up XML documents based on what I specify in the GET string. This is on a server I have no control over. There is a lag between the time when I...
2
by: Thomas Baruchel | last post by:
Hi, wondering about: func1: setjmp() ; func2(); func2: {FILE *f; f = fopen(); func3(); fclose(f)} func3 : if() longjmp; else return; Note that FILE *fis a local variable in func2.
28
by: Sathyaish | last post by:
If fopen fails, is there a way to know why?
1
by: thomson | last post by:
Hi all, I have created a Web Application in my system, This application is accessed only in the local network. I have observed that in some machine When there is a post back it will be taking...
2
by: Brian Kitt | last post by:
I have a process where I do some minimal reformating on a TAB delimited document to prepare for DTS load. This process has been running fine, but I recently made a change. I have a Full Text...
7
by: Justin Koivisto | last post by:
system: php 4.4.2 windows 2003 server apache 1.3.x problem: scripts don't work :-P description:
16
by: Hans Fredrik Nordhaug | last post by:
I'm trying to write to a file in the current directory - no remote files. The subject says it all - I can add that both the directory and the file is wordwritable. This happens on a (quite good)...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.