|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-01-25 20:45 UTC] mail at tomsommer dot dk
Description:
------------
The SoapClient ignores the "user_agent" option, and sends no User-Agent at all.
Test script:
---------------
$client = new SoapClient('http://www.example.com/', array('user_agent' => 'foo'));
Expected result:
----------------
User-Agent header on the remote server
Actual result:
--------------
No User-Agent header on the remote server
PatchesBug60887_user_agent_FIX_rfc2616_compliant (last revision 2012-01-28 19:19 UTC by carloschilazo at gmail dot com)60887_user_agent_FIX (last revision 2012-01-28 08:28 UTC by carloschilazo at gmail dot com) Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 31 03:00:01 2025 UTC |
Workaround is: $opts = array( 'http'=>array( 'user_agent' => 'foo' ) ); $context = stream_context_create($opts); $client = new SoapClient('http://www.example.com/', array('stream_context' => $context));I've tested it on several machines. It's not a matter of stripping the header, since stream_context works. My test script: <?php if ( isset($_GET['check']) ) { mail('[email protected]', 'ff', print_r(apache_request_headers(), true)); } else { $client = new SoapClient('http://example.com/soap.php?check=1', array('user_agent' => 'foo')); } ?>