php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #18183 [RFE] Configurable "User-Agent" in php_fopen_url_wrap_http()
Submitted: 2002-07-05 08:59 UTC Modified: 2005-06-28 23:14 UTC
From: jos_php dot net at interexa dot de Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.1.2 OS: all
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jos_php dot net at interexa dot de
New email:
PHP Version: OS:

 

 [2002-07-05 08:59 UTC] jos_php dot net at interexa dot de
It would be helpful if the "User-Agent"-String in fopen('http://...') calls would be configurable.

The file affected is ext/standard/http_fopen_wrapper.c, line 180.

Maybe we could define a global variable which is set to "PHP/PHP_VERSION" by default, but can be overwritten. Or an optional parameter to the fopen() function. But would be also useful in include() calls...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-05 09:19 UTC] derick@php.net
Recategorize
 [2002-07-05 16:10 UTC] tal@php.net
Maybe a set_user_agent() function?

-Tal
 [2002-07-05 16:30 UTC] mfischer@php.net
Why not an ini setting like fopen.user_agent ?

I think we should use the INI infrastructure if we want to make thsi customizeable at all. There's no need to add a new function when we simply can do

  ini_set("fopen.user_agent", "foobar");

We can even query it with ini_get(), means we don't need a get_user_agent() and we can give it a default value like "PHP <version numer>" if it's not set at all.
 [2002-07-05 16:50 UTC] tal@php.net
Markus - i agree.
I totally forgot about INI :-)

-Tal
 [2002-07-05 18:23 UTC] edink@php.net
I don't think this is really necessary. The fopen wrappers were designed for consistency among different ways of getting data, not to support every little detail of every protocol. If you do need greater control, I suggest using cURL functions.
 [2002-07-06 08:36 UTC] jos_php dot net at interexa dot de
I sure think this is necessary! fopen() or even include() is the easiest way to "tunnel" a website throgh another, but without the ability to use the same agent identifier as the calling browser the called website will send the wrong data if it distingishes between different browsers. The user may get javascript errors for example.
 [2005-06-28 23:14 UTC] nlopess@php.net
This already exists in PHP 5 via contexts and an ini option.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 06:01:29 2024 UTC