PHP libraries? Function to open remote http doc
| From: | (Sean Straw / PSE) | Date: | Wed, 13 Dec 2000 17:31:47 +0000 |
| Subject: | PHP libraries? Function to open remote http doc | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-30117@lists.php.net to get a copy of this message | ||
Specifically, I'm opening a remote http document where I need to provide cookie information and possibly other headers AND deal with potential redirections (effectively, I have to proxy the request and parse the results before passing them back to the user). I've written a real kludge of a function that does basically what I need (sort of like fopen, but read-only and with an optional headers field so the caller can pass it httpd auth and cookies and what-not), but I can't help but think that this sort of function is something which should have been needed by countless others already and that someone has already written a complete implementation.
Perhaps there's a library which incorporates such a function?
I also note extreme server loading (a single httpd process can consume 90%+ of CPU) when fetching remote files like so:
while ( $feof( $fp ) )
{
$line = fread( $fp, 4096 );
fwrite( $fo, $line );
}
Once negotiation is performed, this is the beef of the script.
Pointers anyone?
---
Please DO NOT carbon me on list replies. I'll get my copy from the list.
Sean B. Straw / Professional Software Engineering
Post Box 2395 / San Rafael, CA 94912-2395