Re: Read a website with Fopen()



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;
?>

.



Relevant Pages

  • Re: vim port have a lot of broken links ??
    ... It's only the vim ports (other = screen ... sudo wget bash apache22 mysql-server subversion etc) ... And the ISP is not the problem - I works for them in the network department ... => Attempting to fetch from http://ftp.vim.org/pub/vim/unix/. ...
    (freebsd-questions)
  • Re: vim port have a lot of broken links ??
    ... sudo wget bash apache22 mysql-server subversion etc) ... And the ISP is not the problem - I works for them in the network department ... => Attempting to fetch from http://ftp.vim.org/pub/vim/unix/. ... However, it seems as though ftp.vim.org is IPv6 enabled, but both fetch ...
    (freebsd-questions)
  • Re: vim port have a lot of broken links ??
    ... sudo wget bash apache22 mysql-server subversion etc) ... And the ISP is not the problem - I works for them in the network department ... => Attempting to fetch from http://ftp.vim.org/pub/vim/unix/. ...
    (freebsd-questions)
  • Re: Mirroring website without wget?
    ... Are there any other tools that I can use to mirror a website without ... using wget. ... The site needs a username and password and I copied ... Firefox, Opera, and for that matter Internet Explorer have no ...
    (uk.comp.os.linux)
  • Re: vim port have a lot of broken links ??
    ... sudo wget bash apache22 mysql-server subversion etc) ... And the ISP is not the problem - I works for them in the network department ... => Attempting to fetch from http://ftp.vim.org/pub/vim/unix/. ... I regularly change this master sites based on geographical location. ...
    (freebsd-questions)