Re: Read a website with Fopen()
- From: petersprc <petersprc@xxxxxxxxx>
- Date: Fri, 30 Nov 2007 03:31:15 -0800 (PST)
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...@xxxxxxxxxxx> 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;
?>
.
- References:
- Read a website with Fopen()
- From: zenner
- Read a website with Fopen()
- Prev by Date: Re: How to open and read "feed:" in PHP?
- Next by Date: Re: php mail() not sending to mail Clients (ie, Outlook, Apple Mail, thunderbird, etc..)
- Previous by thread: Read a website with Fopen()
- Next by thread: Re: Read a website with Fopen()
- Index(es):
Relevant Pages
|