Re: Change user agent when using file() or fopen()

From: Date: Thu, 29 Aug 2002 12:15:17 +0000
Subject: Re: Change user agent when using file() or fopen()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-114503@lists.php.net to get a copy of this message
You'll have to do it the hard way if you need that functionality - i.e. open a port on the remote machine (port 80), build a http query, send it and read from the port. That way you can control the whole process and send whatever browser identification, require certain languages, manage the transfer etc. Bogdan David Yee wrote:
How do I change the "browser" name and version presented to the target web server when I use file() or fopen()? E.g. <?php $content = file('http://foo.bar/foo.html'); ?> The access_log for the web server will show something like: 127.0.0.1 - - [29/Aug/2002:00:08:59 -0700] "GET /foo.html HTTP/1.0" 404 45 "-" "PHP/4.2.2" I want to change "PHP/4.2.2" to something like "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT)". I looked in php.ini but couldn't find a setting for this. Anyone know where to set this? Thanks. David


« previous php.general (#114503) next »