/    Sign up×
Community /Pin to ProfileBookmark

changing user agent via php

I had an idea but I don’t know if php is capible of doing it. Does php have the ablity to change the user agent field when it requests a file?

Like say I have an include that includes my navbar for each page saving me time. Could I have php request that file with a different user agent? Does what I’m saying make sence?

to post a comment
PHP

8 Comments(s)

Copy linkTweet thisAlerts:
@ShrineDesignsApr 17.2005 — yes, you can set this in the php.ini file, or in a .htaccess file via the user_agent directive, and i think, in a script by using ini_set()
Copy linkTweet thisAlerts:
@FrozenDiceauthorApr 17.2005 — Sweet! ?

I don't know much about php so it would be really helpfull if anyone knew of a link to where I could learn about that specific script/function.

My idea was that I could basicly have a page where people would type in a url of a website. Then under that would be a messagebox where the type a comment. This would take the message and set the user agent = to that message. Then it would request the index.html from the url and effectivly let people leave messages to admins or operators in the raw logs. It could be a way to contact an admin who is paranoid and constantly checks logs, etc. Kinda like a guest board which is applicable for ANY url. What is the max legnth of the UA field?
Copy linkTweet thisAlerts:
@96turnerriApr 17.2005 — 39 i think
Copy linkTweet thisAlerts:
@FrozenDiceauthorApr 17.2005 — Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

That's IE on xp. It's 50. UA must be >= 50
Copy linkTweet thisAlerts:
@96turnerriApr 17.2005 — touche
Copy linkTweet thisAlerts:
@FrozenDiceauthorApr 18.2005 — AHHHHHHHHHHHHHHh I'm gona go nuts! I installed apache and php but I don't wana deal with configuring the whole thing to test 1 small 2 line script. Doubt I would be capible of it either. I spent the last 30 minutes trudging through google's horrible restults (blame the google bombs), and I have yet to find a simple free hosting site I could just upload my scripts to to test.

Please i'm begging. What is the easier way? Do you know of a SIMPLE host?

so far I have

<?php

ini_set(user_agent, $_POST['ua']);

echo $_
SERVER['HTTP_USER_AGENT'];

?>

I just have a forum that posts the message called ua. And I'm having it print out the user agent to test it. I can't even run this because I don't know how to configure my stupid server.
Copy linkTweet thisAlerts:
@nixApr 18.2005 — http://www.oinko.net/freephp/ has a directory of free php hosts.

hmmm... I know how you feel about setting up your server, I tried four times gave up for 9 months, then did it about 2 weeks ago and got it set up. turns out I was missing one line in my php.ini file. the AddType application/x-httpd-php .php .phtml

you should try again with setting up your own server. its a heck of a lot faster than uploading your files each and every time. I assure you ?
Copy linkTweet thisAlerts:
@bokehApr 18.2005 — I´ve tried a few php/apache packages but my favorite for easy installation is [URL=http://prdownloads.sourceforge.net/appserv/appserv-win32-2.4.2.exe?use_mirror=easynews]here[/URL] . In fact it was so easy it inspired my to start a public home web server.
×

Success!

Help @FrozenDice spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...