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 16:47:54 -0500

On 11/11/10 4:29 PM, "Daniel Stenberg" <daniel_at_haxx.se> wrote:

>On Thu, 11 Nov 2010, Tom Worster wrote:
>
>> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7
>> OpenSSL/0.9.8l zlib/1.2.3
>
>> 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.
>
>That's the user-agent the command line tool curl uses. libcurl that does
>the
>request and that PHP/CURL uses, doesn't have any default user-agent at
>all so
>you can't get that.

ok. thanks.

>libcurl does however offer an API to extract all the version number infos
>etc
>if you would like to produce a string like the above, but I don't know
>exactly
>how or what the PHP binding exposes in that area.

$ php -r "print_r(curl_version());"
Array
(
    [version_number] => 463623
    [age] => 3
    [features] => 573
    [ssl_version_number] => 0
    [version] => 7.19.7
    [host] => universal-apple-darwin10.0
    [ssl_version] => OpenSSL/0.9.8l
    [libz_version] => 1.2.3
    [protocols] => Array
        (
            [0] => tftp
            [1] => ftp
            [2] => telnet
            [3] => dict
            [4] => ldap
            [5] => http
            [6] => file
            [7] => https
            [8] => ftps
        )
)

I guess I'll have to assemble something from that.

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