Re: Fw: Spoofing user_agent
| From: | Ron Piggott | Date: | Tue, 30 Nov 2010 15:19:16 +0000 |
| Subject: | Re: Fw: Spoofing user_agent | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-309767@lists.php.net to get a copy of this message | ||
The following solution works:
I set my user-agent to:
VerseOfTheDaySitemapRobot/1.0 (http://www.TheVerseOfTheDay.info)
By doing:
ini_set('user_agent', "VerseOfTheDaySitemapRobot/1.0
(http://www.TheVerseOfTheDay.info)");
When ran by a cron job this causes AWSTATS to treat the hits as:
Unknown robot (identified by 'robot') 9704+18 284.82 MB 30 Nov 2010 - 07:12
The part which tricked me is that if I run the site map generator PHP script using a user interface
the hits on the site are credited to the Firefox (the browser I use) user-agent string. The
following article discusses how to change browser user agents:
http://www.walkernews.net/2007/07/05/how-to-change-user-agent-string/
Ron
The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info