« Compiling re2c 0.13.5 on Ubuntu 8.04+ (binaries available) | Home | Manipulating symbolic and hard links on Linux and Windows »
Changing the user agent of PHP
By admin | August 20, 2008
If you ever need to adjust or change the default user agent that PHP accesses pages with (http and ftp wrappers) because either the default PHP user agent was blocked (“PHP”) or you wrote a bot with PHP and wish to customize it, you can do so easily with a php directive called “user_agent”. Note that 3rd party ways (such as cURL) are not affected by this setting.
To set it, you can use the following function:
<?php
function set_php_user_agent($useragent = ‘PHP’) {
$u = strval($useragent);
if(ini_set(‘user_agent’,$u) === false) {
$r = false;
} else {
$r = true;
}
return $r;
}
// Example:
set_php_user_agent(‘TestAgent/1.0 (http://www.example.com/testagent/)’);
?>
To get you started, here are some user agents for you to use or test:
- Mozilla/2.01 (Win16; I) – Netscape 2 on Windows 3.1
- Mozilla/2.0 (compatible; MSIE 3.0; I; Win95) – IE 3 on Windows 95
- Mozilla/3.0 (WinNT4; I) – Netspace 3 on Windows NT4
- Mozilla/4.0 (compatible; MSIE 4.01; Win98) – MSIE 4.01 on Windows 98
- Opera/5.11 (compatible; MSIE 5.0; Windows ME) [en] – Opera 5.11 on Windows ME
- Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) – IE6 on WinXP
- Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9) Gecko/2008061015 Firefox/3.0 (ubuntu-hardy) – Firefox 3.0 on Ubuntu Hardy
- Lynx/2.8.6rel.4 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/2.0.4 (Linux i686) – Lynx 2.8.6 on Linux
- Mozilla/5.0 Galeon/1.0.2 (X11; Linux i686; U;) Gecko/20011224 – Galeon 1.0.2 on Linux
- Lynx/2.8.6rel.4 (Windows NT 5.1; I) – Lynx 2.8.6 on Windows XP
- Wget/1.10.2 – GNU Wget 1.10.2
If you found this article interesting or helpful, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more interesting articles!
If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!
Topics: Internet, PHP | 692 Comments »

January 19th, 2026 at 14:01
เขียนได้น่าสนใจมากครับ
Review my site – terea iqos ราคา
January 19th, 2026 at 14:07
สวัสดีครับ ชอบบทความนี้จัง กำลังหาข้อมูลเกี่ยวกับ iqos อยู่พอดี ขอบคุณที่แบ่งปันข้อมูลดีๆ ครับ
Feel free tto visit my site iqos thailand
January 19th, 2026 at 14:09
ขอบคุณสำหรับข้อมูลครับ
Also visit my homepage :: บุหรี่ terea ราคา
January 19th, 2026 at 14:16
สวัสดีครับ ชอบบทความนี้จัง ใครที่สนใจ iqos ต้องมาอ่านตรงนี้เลย ขอบคุณที่แบ่งปันข้อมูลดีๆ ครับ
Also visit my web blog: iqos bangkok
January 19th, 2026 at 14:18
สวัสดีครับ เนื้อหาแน่นปึ้ก อ่านแล้วได้ความรู้เรื่อง iqos เพิ่มขึ้นเยอะเลย จะรอติดตามบทความต่อไปนะครับ
Alsso visit myy site; iqos terea
January 19th, 2026 at 14:21
ติดตามผลงานอยู่นะครับ
Feeel free to surf too my weebsite … terea บุหรี่ ซื้อ ที่ไหน
January 19th, 2026 at 14:32
สวัสดีครับ บทความนี้มีประโยชน์มาก
กำลังหาข้อมูลเกี่ยวกับ iqos อยู่พอดี ขอบคุณมากครับ
Also vvisit my web page – iqos thailand
January 19th, 2026 at 14:47
ทักทายครับ บทความนี้มีประโยชน์มาก ใครที่สนใจ iqos ต้องมาอ่านตรงนี้เลย เป็นกำลังใจให้นะครับ
Feel free to surf to my webpage: iqos iluma
January 19th, 2026 at 16:58
สวัสดีจ้า เนื้อหาแน่นปึ้ก ช่วยให้เข้าใจเรื่อง iqos มากขึ้น จะรอติดตามบทความต่อไปนะครับ
My site iqos thailand
January 19th, 2026 at 17:00
สวัสดีครับ ชอบบทความนี้จัง ช่วยให้เข้าใจเรื่อง iqos มากขึ้น จะรอติดตามบทความต่อไปนะครับ
Feel fre to visit my homepage – iqos bangkok
January 19th, 2026 at 17:06
สวัสดีครับ เนื้อหาแน่นปึ้ก ช่วยให้เข้าใจเรื่อง ios มากขึ้น ขอบคุณมากครับ
Stop by my web-site … iqos thailand
January 19th, 2026 at 17:33
สวัสดีครับ เขียนได้ดีมากเลยครับ กำลังหาข้อมูลเกี่ยวกับ
iqos อยู่พอดี เป็นกำลังใจให้นะครับ
My blog post :: iqos iluma
January 19th, 2026 at 17:35
ทักทายครับ เขียนได้ดีมากเลยครับ อ่านแล้วได้ความรู้เรื่อง iqos เพิ่มขึ้นเยอะเลย ขอบคุณมากครับ
Here is mmy homepage … iqos terea
January 19th, 2026 at 17:38
สวัสดีจ้า เนื้อหาแน่นปึ้ก ใครที่สนใจ iqos ต้องมาอ่านตรงนี้เลย
จะรอติดตามบทความต่อไปนะครับ
Also visit my webpage … iqos bangkok
January 19th, 2026 at 18:01
สวัสดีครับ บทความนี้มีประโยชน์มาก ใครที่สนใจ iqos ต้องมาอ่านตรงนี้เลย จะรอติดตามบทความต่อไปนะครับ
my webpage – iqos bangkok
January 19th, 2026 at 18:03
สวัสดีครับ บทความนี้มีประโยชน์มาก ใครที่สนใจ iqos ต้องมาอ่านตรงนี้เลย เป็นกำลังใจให้นะครับ
January 19th, 2026 at 18:33
ทักทายครับ เขียนได้ดีมากเลยครับ ช่วยให้เข้าใจเรื่อง iqos มากขึ้น จะรอติดตามบทความต่อไปนะครับ
Feel free to visit my blog pos :: iqos iluma
January 19th, 2026 at 18:43
สวัสดีจ้า เขียนได้ดีมากเลยครับ ใครที่สนใจ iqos
ต้องมาอ่านตรงนี้เลย เป็นกำลังใจให้นะครับ
Feel free to isit my site … iqos iluma
January 20th, 2026 at 04:14
บทความมีประโยชน์มากครับ
Here is my web page; terea บุหรี่
January 20th, 2026 at 04:24
ติดตามผลงานอยู่นะครับ
Also visit my web blog – terea บุหรี่ ราคา
January 20th, 2026 at 04:35
เป็นข้อมูลที่ดีมากครับ
my webpage; บุหรี่terea
January 20th, 2026 at 04:54
สวัสดีจ้า เนื้อหาแน่นปึ้ก ช่วยให้เข้าใจเรื่อง iqos มากขึ้น ขอบคุณมากครับ
January 20th, 2026 at 04:55
ติดตามผลงานอยู่นะครับ
Here is my web-site: บุหรี่ terea
January 20th, 2026 at 04:58
สวัสดีจ้า เนื้อหาแน่นปึ้ก อ่านแล้วได้ความรู้เรื่อง iqos เพิ่มขึ้นเยอะเลย ขอบคุณที่แบ่งปันข้อมูลดีๆ ครับ
January 20th, 2026 at 05:22
ทักทายครับ เขียนได้ดีมากเลยครับ อ่านแล้วได้ความรู้เรื่อง iqos เพิ่มขึ้นเยอะเลย ขอบคุณที่แบ่งปันข้อมูลดีๆ ครับ
Check oout my web blog :: iqos bangkok
January 20th, 2026 at 06:23
อ่านเพลินเลยครับ ขอบคุณครับ
Feel free to surf to myy webpage :: iqos terea
January 20th, 2026 at 06:24
สุดยอดเลยครับสำหรับบทความนี้
Here is my web bog – terea iqos ราคาส่ง
January 22nd, 2026 at 15:57
อ่านเพลินเลยครับ ขอบคุณครับ
Also visit mmy site – terea iqos ราคา
January 22nd, 2026 at 16:37
ติดตามผลงานอยู่นะครับ
Heere is my website: terea ราคา
January 22nd, 2026 at 16:54
เนื้อหาแน่นมาก ขอบคุณที่แชร์
my webpage :: terea บุหรี่
January 22nd, 2026 at 16:57
เป็นข้อมูลที่ดีมากครับ
Lookk att my website … terea บุหรี่
January 22nd, 2026 at 17:39
ขอบคุณสำหรับข้อมูลครับ
my website; บุหรี่ terea ราคา
January 22nd, 2026 at 18:04
ทักทายครับ เนื้อหาแน่นปึ้ก ใครที่สนใจ iqos ต้องมาอ่านตรงนี้เลย ขอบคุณมากครับ
January 22nd, 2026 at 18:21
ขอบคุณสำหรับข้อมูลครับ
Look into my homepage … บุหรี่terea
January 22nd, 2026 at 18:50
บทความมีประโยชน์มากครับ
Also visit my blog … terea บุหรี่
January 22nd, 2026 at 18:52
ติดตามผลงานอยู่นะครับ
Also visit my web-site … บุหรี่terea
January 22nd, 2026 at 19:09
ทักทายครับ เขียนได้ดีมากเลยครับ ช่วยให้เข้าใจเรื่อง iqos
มากขึ้น ขอบคุณมากครับ
my site; terea iqos
January 22nd, 2026 at 20:22
สวัสดีครับ เขียนได้ดีมากเลยครับ อ่านแล้วได้ความรู้เรื่อง iqos เพิ่มขึ้นเยอะเลย เป็นกำลังใจให้นะครับ
Visit my website terea iqos
January 22nd, 2026 at 20:45
ทักทายครับ เนื้อหาแน่นปึ้ก
อ่านแล้วได้ความรู้เรื่อง iqos เพิ่มขึ้นเยอะเลย จะรอติดตามบทความต่อไปนะครับ
Feel free to surf to myy page :: iqos iluma
January 22nd, 2026 at 21:07
สวัสดีครับ เนื้อหาแน่นปึ้ก อ่านแล้วได้ความรู้เรื่อง iiqos เพิ่มขึ้นเยอะเลย เป็นกำลังใจให้นะครับ
My web-site: iqos thailand
January 22nd, 2026 at 21:19
สวัสดีครับบทความนี้มีประโยชน์มาก ใครที่สนใจ iqos ต้องมาอ่านตรงนี้เลย ขอบคุณมากครับ
Here is my web blog :: iqos thailand
January 23rd, 2026 at 00:02
ทักทายครับ เนื้อหาแน่นปึ้ก ช่วยให้เข้าใจเรื่อง iqos มากขึ้น จะรอติดตามบทความต่อไปนะครับ
Also visit my blog post: terea iqos