This is a discussion on Server Stall within the PHP General forums, part of the PHP Programming Forums category; Hi, One of my scripts are using wget to get external xml data $fp = popen ("wget -O - '".$dst.&...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
One of my scripts are using wget to get external xml data $fp = popen ("wget -O - '".$dst."' | cat","r"); Some time $dst host responds very slowly. And that time if I open another connection to same server the second request waits to complete wget operation. I'm very noobie about this file operations. Is there any suggestion about this situation ? Regards. Sancar |
|
|||
|
On Mon, February 5, 2007 11:42 am, Sancar Saran wrote:
> Hi, > > One of my scripts are using wget to get external xml data > > $fp = popen ("wget -O - '".$dst."' | cat","r"); > > Some time $dst host responds very slowly. And that time if I open > another > connection to same server the second request waits to complete wget > operation. > > I'm very noobie about this file operations. Is there any suggestion > about this > situation ? If you are trying to open multiple streams in a single PHP script in parallel, you want http://php.net/stream_select If you are just testing it with another script, and they are both taking a long time, that just means that $dst is slow right now. I would also suggest that you pull out the wget part and put it into a cron job, and then let PHP use the most recent download from wget that's available. That way, your script isn't sitting around waiting for a slow download. It just runs at max speed on the local file which is the most recent download available. It sounds bassackwards, but ends up being a much easier solution, as well as a better user experience, and more maintainable, as you've pulled the whole wget mess out of the PHP script and modularized it. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? |