php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #64723 Set default value for CURLOPT_USERAGENT
Submitted: 2013-04-26 14:56 UTC Modified: 2016-04-24 03:21 UTC
Votes:3
Avg. Score:3.7 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: dr_mantis at regad dot org Assigned:
Status: Wont fix Package: cURL related
PHP Version: 5.4.14 OS: N/A
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dr_mantis at regad dot org
New email:
PHP Version: OS:

 

 [2013-04-26 14:56 UTC] dr_mantis at regad dot org
Description:
------------
When calling curl from command-line, unless specified otherwise it sets by default the User Agent to 'curl/x.y.z'.

It would be nice if the php curl extension did the same thing (at the moment, the user agent is set to blank), to avoid having to do something like

$v = curl_version();
curl_setopt( $curl, CURLOPT_USERAGENT, 'curl/' . $v['version'] );

Test script:
---------------
$ curl localhost

==> access.log
::1 - - [26/Apr/2013:16:54:52 +0200] "GET / HTTP/1.1" 200 1665 "-" "curl/7.27.0"

$ php -a
php > $c = curl_init('localhost');
php > curl_exec($c);

==> access.log
::1 - - [26/Apr/2013:16:53:15 +0200] "GET / HTTP/1.1" 200 1665 "-" "-"



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-03-05 20:59 UTC] narf at devilix dot net
-1

This would be a BC break and those are not nice ...
Plus, I see no reason why I should be forced to explicitly set the user-agent to an empty one.
 [2016-04-24 03:21 UTC] pierrick@php.net
-Status: Open +Status: Wont fix
 [2016-04-24 03:21 UTC] pierrick@php.net
I don't see any good reason to add a default user agent. You can easily add one if needed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 07 00:01:28 2024 UTC