I am using PHP 4.3.2 as an Apache 1.3.26 module on a Linux machine.
I want to send my own User-agent HTTP header instead of PHP's default one (PHP/4.3.2) when requesting a remote URL over fopen().
php.net tells to modify php.ini, which obviously doesn't show any effect. So I tried it another way:
ini_set("user_agent", "My Own User Agent");
$fp = fopen("http://any.url.on.the.net/", "r");
If I run the script directly from the Linux shell (php script.php), this works fine. The log file at any.url.on.the.net shows "My Own User Agent".
But not so if I run it via HTTP. The ini_set() command is completely ignored. In fact, there is no "user_agent" ini setting at all in the array delivered by ini_get_all() when running via HTTP - neither before nor after the ini_set().
I spent the whole night searching the web for a solution, but I couldn't find any. :mad:
Please do not tell me to use fsockopen() instead of fopen(). I know that, but for several reasons I need to do it with fopen().
Philipp