SoapFault身份验证和PHP

时间:2018-10-03 10:35:55

标签: php soap-client

我正在尝试使用php中的Soap Client向Soap bases API发送此请求,但正在收到auth error作为我的请求的响应

这是我的要求

$options =  array(
'cache_wsdl' => 0,
'trace' => 1,
'stream_context' => stream_context_create(array(
      'ssl' => array(
           'verify_peer' => false,
            'verify_peer_name' => false,
            'allow_self_signed' => true
      )
)));

 $client = new \SoapClient('https://alison.com/api/service.php?wsdl', $options);


    $header = array();

    $auth = array(
        'alisonOrgId' => '9ReXlYlpOThe24AWisE',
        'alisonOrgKey' => 'C2owrOtRegikaroXaji'
    );

    $header[] = new \SoapHeader('https://alison.com/api/service.php?wsdl', 'credentials', $auth,false);

    $client->__setSoapHeaders($header);

    $res = $client->getUserId('example@gmail.com');

     dd($res);

如何解决此错误

0 个答案:

没有答案