|
Posted by petersprc on 11/30/07 11:31
Hi,
You can adjust the User-Agent header like so:
ini_set('user_agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.8.1.10) Gecko/20071115 Firefox/2.0.0.10');
Then fetch a page:
$doc = file_get_contents('http://example.net');
If you want to implement a mirror, you can use mod_proxy and
mod_proxy_html. For example:
ProxyPass /my/mirror/ http://example.net/
If you want to store locally a page and associated images and scripts,
you can use wget with the -p option:
wget -p http://example.net
On Nov 30, 6:01 am, zenner <pro.ra...@hotmail.com> wrote:
> Hello.
> when i try to "read" some websites with fopen() some of them allow but
> some don't
> Does the server knows that it´s not a web browser that it's trying to
> access?
> How can i solve this??
>
> Below is an example of a site that gives an error when you try to read
> it.
>
> <?php
> $file="http://www.radios.pt/portalradio/";
> $fp = fopen($file, "r");
> while (!feof($fp))
> {
> $a=$a.fgets($fp);}
>
> fclose($fp);
> echo $a;
> ?>
Navigation:
[Reply to this message]
|