473,790 Members | 2,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is User Agent Change Possible?

I heard PHP hard coded useragent in several places. It sucks, unlike Perl
which you can enter anything. It is even worse than Wget.

I wonder if PHP5 allows User Agent changes now, because it seems to add many
header related functions. But I still did not see one yet.
Jul 17 '05 #1
10 3530
Hello,

On 07/21/2004 01:47 AM, Asker wrote:
I heard PHP hard coded useragent in several places. It sucks, unlike Perl
which you can enter anything. It is even worse than Wget.

I wonder if PHP5 allows User Agent changes now, because it seems to add many
header related functions. But I still did not see one yet.


What do you mean? The user agent is defined by the browser that requests
the pages. Do you mean when PHP fetches remote pages via fopen()?

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Jul 17 '05 #2
> What do you mean? The user agent is defined by the browser that requests
the pages. Do you mean when PHP fetches remote pages via fopen()?


yes, i meant that in fopen
Jul 17 '05 #3
On Wed, 21 Jul 2004 01:15:59 -0400
"Asker" <ne************ ********@alexa. com> wrote:
What do you mean? The user agent is defined by the browser that
requests the pages. Do you mean when PHP fetches remote pages via
fopen()?


yes, i meant that in fopen


I'm sorry, but why do you even bother?
I mean, if it really is that important to you, write a wrapper for the
perl-thingy... Or even better... Grab the latest PHP source and edit it
yourself...

Madsen

--
Anders K. Madsen --- http://lillesvin.linux.dk

"There are 10 types of people in the world.
Those who understand binary - and those who don't."

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA/gKQlNHJe/JASHcRAoxiAJ9up B6xLfgteIoGK1or uu3mw9G7ewCeIgF y
P16vmVe0Pu+gm/8poZgLzP0=
=rDZO
-----END PGP SIGNATURE-----

Jul 17 '05 #4
Asker wrote:
yes, i meant that in fopen


You can set user_agent in php.ini.
http://www.php.net/manual/en/ref.fil...ini.user-agent
Jul 17 '05 #5
Hello,

On 07/21/2004 02:15 AM, Asker wrote:
What do you mean? The user agent is defined by the browser that requests
the pages. Do you mean when PHP fetches remote pages via fopen()?

yes, i meant that in fopen


In that case you can set it in the php.ini file. If you can't set it in
the php.ini, you need to fetch the page with fsockopen instead.

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Jul 17 '05 #6
I haven't investigated, so I'm just going to ask...
Am I the only one for whom every one of Anders' posts arrives blank with the
message included in an attachment as a .txt file and his PHP signature
included as an attachment in a .dat file?

- Virgil
Jul 17 '05 #7
On Wed, 21 Jul 2004 17:36:39 GMT
"Virgil Green" <vj*@DESPAMobsy dian.com> wrote:
I haven't investigated, so I'm just going to ask...
Am I the only one for whom every one of Anders' posts arrives blank
with the message included in an attachment as a .txt file and his PHP
signature included as an attachment in a .dat file?


This is indeed odd... 'Cause I think most people don't have any problem
with it (people on comp.lang.ruby being less forgiving about
non-standard ways of posting).

What news-client do you use?

Oh yeah... PGP signature (not PHP) :) http://gnupg.org

Madsen

--
Anders K. Madsen --- http://lillesvin.linux.dk

"There are 10 types of people in the world.
Those who understand binary - and those who don't."

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA/u7blNHJe/JASHcRAoKvAJ45W 3nwqy59tXd+oZyE 4c+jqozeegCeO3V Q
wi3VxaofVzLrmFF 7B1A3+ak=
=q7XW
-----END PGP SIGNATURE-----

Jul 17 '05 #8
"Manuel Lemos" <ml****@acm.org > wrote in message
news:40******** ****@acm.org...
Hello,
On 07/21/2004 02:15 AM, Asker wrote:
What do you mean? The user agent is defined by the browser that requests
the pages. Do you mean when PHP fetches remote pages via fopen()?

yes, i meant that in fopen


In that case you can set it in the php.ini file. If you can't set it in
the php.ini, you need to fetch the page with fsockopen instead.


Not entirely true. You can change the user agent with ini_set().

ini_set('user_a gent', 'Bobo the Clown');

With more recent versions of PHP you can also create a stream context for
the same purpose:

$opts = array(
'http'=>array(
'method'=>"GET" ,
'header'=>"Acce pt-language: en\r\n" .
"Cookie: foo=bobo\r\n" .
"User-Agent: Bobo the Clown\r\n"
)
);

$context = stream_context_ create($opts);
$fp = fopen($url, 'r', false, $context);
--
Obey the Clown - http://www.conradish.net/bobo/
Jul 17 '05 #9
"Anders K. Madsen" <ma****@lillesv in.linux.dk> wrote in message
news:2004072200 3152.0122e0a5@l apsvin...
On Wed, 21 Jul 2004 17:36:39 GMT
"Virgil Green" <vj*@DESPAMobsy dian.com> wrote:
I haven't investigated, so I'm just going to ask...
Am I the only one for whom every one of Anders' posts arrives blank
with the message included in an attachment as a .txt file and his PHP
signature included as an attachment in a .dat file?

This is indeed odd... 'Cause I think most people don't have any problem
with it (people on comp.lang.ruby being less forgiving about
non-standard ways of posting).

What news-client do you use?


Outlook Express... you may stop laughing now... ;-)
Oh yeah... PGP signature (not PHP) :) http://gnupg.org


Typo on my part. I meant PGP, but have typed PHP too many times for it not
to flow out naturally.

- Virgil
Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2660
by: studio | last post by:
I have a simple crawler as part of a website. It uses file() to copy HTML content from a web page on another website and reformat it into a new HTML page using a template. Is there a simple way of having the crawler supply a custom HTTP user agent header to identify itself to the website being crawled? I don't want to alter the php.ini file, I need to set the user agent value from PHP if possible. Thanks
3
4477
by: Michael | last post by:
How do you change the user agent reported by urllib? I need to access a resource that rejects anything but IE.
60
7310
by: Fotios | last post by:
Hi guys, I have put together a flexible client-side user agent detector (written in js). I thought that some of you may find it useful. Code is here: http://fotios.cc/software/ua_detect.htm The detector requires javascript 1.0 to work. This translates to netscape 2.0 and IE 3.0 (although maybe IE 2.0 also works with it)
111
14432
by: Retlak | last post by:
The recommended (on dozens of websites) and effective (works in Netscape, MSIE, Mozilla, probably others) way to detect if a browser has Javascript turned off is to put this in the <head>: <noscript> <meta http-equiv="refresh" content="1;url=http://yourURL/nojscript.html"> </noscript> This redirects to a doc which typically says "You need to enable
3
2007
by: LIN | last post by:
Hi, In my log files I often simple 'Mozilla' as UserAgent. In that case what may be the browser type. If Mozilla/4.0 is the UserAgent can we take it as a Netscape Browser. LIN
5
11686
by: Rainmanjam | last post by:
I have a web site that uses MSN Live Maps. It works in Opera if I change the User Agent to IE. Is there a way to change the User Agent via Javascript for one page?
35
2496
by: RobG | last post by:
Seems developers of mobile applications are pretty much devoted to UA sniffing: <URL: http://wurfl.sourceforge.net/vodafonerant/index.htm > -- Rob
0
1803
by: TejasMehta | last post by:
Hello all, I m creating one window application for sending request to URL and getting response from there by http webrequest.Here i want to modify user agent string to change the browser information on request send by web request. but i am not getting any guidence about how to modify user agent string in c#.net. Please give any help....Thank You.
5
7058
by: Gordon | last post by:
As part of a data collecting system (basically a system that collects submissions from forms), I was planning on logging a bit of data about the submitting user agent for the purposes of spotting things like multiple submissions. We don't want to block multiple submissions altogether, we just want to be able to easily spot them. My idea was to use the $_SERVER fields to get some data about the user agent, md5 the collected data and...
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9512
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10145
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9021
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7530
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4094
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3707
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.