cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Get the User-Agent string?

From: Tom Worster <fsb_at_thefsb.org>
Date: Thu, 11 Nov 2010 15:32:51 -0500

Curl does things like this:

GET / HTTP/1.1
User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7
OpenSSL/0.9.8l zlib/1.2.3
Host: 127.0.0.1:12345
Accept: */*

That's a swell User-Agent value. Very informative.

In my application, I want to send an informative User-Agent such as this
but modified to identify also my application. Hence I want to find the
proper UA string for the php curl instance on the server so that I can
manipulate it.

So can I read such a string value in a PHP script?

On other words: We are given a UA setter curl_setopt(,
CURLOPT_USERAGENT,). Is there a corresponding UA getter?

Tom

On 11/11/10 3:02 PM, "Andrey Kuznetsov" <kandrey89_at_gmail.com> wrote:

>You are unclear about what you mean, sending HTTP GET to oneself, what
>does that mean?
>
>If you want to send the useragent of the browser that is running the
>script the use $_SERVER['HTTP_USER_AGENT'] value.
>
>On Thu, Nov 11, 2010 at 11:54 AM, Tom Worster <fsb_at_thefsb.org> wrote:
>> We can set the User-Agent string that cURL will use with
>>
>> curl_setopt($handle, CURLOPT_USERAGENT, 'Something');
>>
>> But is there a way to get this this string value without sending an HTTP
>> GET to oneself?
>>
>> Tom
>>
>>
>> _______________________________________________
>> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>>
>
>
>
>--
>Andrey
>_______________________________________________
>http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2010-11-11