Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将用户名写入httpheader以使用php进行web服务身份验证_Php_Soap_Http Headers - Fatal编程技术网

将用户名写入httpheader以使用php进行web服务身份验证

将用户名写入httpheader以使用php进行web服务身份验证,php,soap,http-headers,Php,Soap,Http Headers,我的代码: $url = "http://x.x.x.x/ws/special/Service?wsdl"; $context = stream_context_create(array('http' => array( 'username' => "jonas" ))); $client = new SoapClient($url, array("trace" => 1, "exception" => 0)); $res = $client->__so

我的代码:

$url = "http://x.x.x.x/ws/special/Service?wsdl";  
$context = stream_context_create(array('http' => array( 'username' => "jonas" )));  
$client = new SoapClient($url, array("trace" => 1, "exception" => 0));  
$res = $client->__soapCall("getinfo",array('counter'=>'10'));  
错误:-

Fatal error: Uncaught SoapFault exception: [S:Server] missing parameter 
'username' in C:\xampp\htdocs\test.php:7 Stack trace: #0 
C:\xampp\htdocs\test.php(7): SoapClient->__soapCall('getAsinfo...', Array)
#1 {main} thrown in C:\xampp\htdocs\test.php on line 7
如何写入http头