Reading in contents of URL
| From: | Mike C | Date: | Fri, 02 Aug 2002 16:04:07 +0000 |
| Subject: | Reading in contents of URL | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-110858@lists.php.net to get a copy of this message | ||
I am trying to create a really simple proxy using PHP.
Basically, i need to:
1. read in the contents of a URL.
2. get the content-type
3. set the content type for the response
4. write the contents of the URL to the response.
here is what i have thus far:
$dataURL = "http://www.foo.com/data.xml";
$fp = fopen($dataURL, "r");
$content = fread($fp, true);
echo($content);
fclose($fp);
I am running into two problems. One, the second param for fread takes the size of the file / content. how do i get this?
there is a comment at:
http://www.php.net/manual/en/function.fread.php
which says to just specify a constant and it will work, but what ever number i specify, that is the amount of data that is read.
how do i retrieve the content type?
thanks for any help...
mike c
mesh@speakeasy.org