Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CHANGE my outgoing HTTP_USER_AGENT

Status
Not open for further replies.

WMAdam

Programmer
Jun 5, 2002
14
0
0
US
Hi All,
This is very easily done in perl, but I can't seem to track down the PHP equivalent. If I have a php page that fetches a piece of information from another web server, how do I change what my http_user_agent shows up as? I couldn't find anything in the php.ini file about it. Currently, the user_agent is: "PHP/4.1.2"
Any help is greatly appreciated.
Adam Jackson
 
If you are using file() to retrieve the page, there is no way to do it short of editing the source and recompile (I think it's set in http_fopen_wrapper.c).

One method which will allow you to set the user agent string is to use curl ( if it is or can be made available.

Barring that, you might try finding a php class which will do the same thing. Snoopy ( is one example. ______________________________________________________________________
TANSTAAFL!
 
Your response was most helpful, thank you for your time!
Adam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top