473,604 Members | 2,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2222
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*******@last name.net.invali d> 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*******@last name.net.invali d> 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*******@last name.net.invali d> posted:
MikeSoja wrote:
On Tue, 18 Oct 2005 14:23:31 +0200, Ewoud Dronkert
<fi*******@la stname.net.inva lid> 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********@nas tysoft.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

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

Similar topics

3
3679
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(): Circular redirect, aborting. Warning: fopen(http://home.pchome.com.tw/world/qoo4ko/110.jpg): failed to open stream: Permission denied ------------------------------------
7
2200
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
2196
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 issue the GET request, and when I actually get the response. (I suspect because the server has to dig for the data and format it. In any case, it's longer than say, a simple HTML page request to the web server.) When I manually cut and paste the...
2
2280
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
33116
by: Sathyaish | last post by:
If fopen fails, is there a way to know why?
1
1234
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 lot of time , but at the same time in some other machine it is not at all taking any time . Iam not able to identify the root cause,
2
3007
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 index on one column, and punctuation in the column was causing some problems down the line. This column is used only for full text indexing, and otherwise ignored. I decided to use the following regular expression to remove all punctuation (actually...
7
10387
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
4674
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) free hoster in Norway which doesn't use safe mode, running PHP 5.1.6 as the PHP info below shows ... Test it at: http://home.no.net/moldevbk/fopen-test/?mode=w (write - fails) http://home.no.net/moldevbk/fopen-test/?mode=a (append - ok)...
0
7997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8409
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8065
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8280
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6739
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5882
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3907
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3955
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2434
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.