小编Gag*_*ngh的帖子

Five9的API:如何使用SOAP API和基本身份验证来提取报告

我们正在尝试使用报告API从Five9的服务器访问数据.我们在下面编写了代码,但没有得到任何结果.对我来说,看起来问题是使用Authentication to Five9的服务器.请检查帮助我们了解我们如何定期为特定广告系列提取数据,并将其存储在数据仓库中.

<?php
$soapUser = "USERNAME";  //  username
$soapPassword = "DEMOPASSWORD"; // password

$soap_options   = array( 'login' => $soapUser, 'password' => $soapPassword );
$auth_details   = base64_encode($soapUser.":".$soapPassword);

$client = new SoapClient("https://api.five9.com/wsadmin/v2/AdminWebService?wsdl",       $soap_options);
$header = new SoapHeader("https://api.five9.com/wsadmin/v2/AdminWebService/getCallLogReport", "authentication", "Basic $auth_details"); 
//echo "Response:\n" . $client->__getLastResponse() . "\n";
$client->__setSoapHeaders($header);

$xml_data = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v2="http://service.admin.ws.five9.com/v2/AdminWebService/getCallLogReport">
<soapenv:Header/>
<soapenv:Body>
  <v2:getCallLogReport>
        <campaigns>Campaign1</campaigns>
  </v2:getCallLogReport>
</soapenv:Body>
</soapenv:Envelope>';

echo $result = $client->getCallLogReport($xml_data,   "https://api.five9.com/wsadmin/v2/AdminWebService?wsdl", "https://api.five9.com/wsadmin/v2/AdminWebService/getCallLogReport",0); 


?>  
Run Code Online (Sandbox Code Playgroud)

示例XML

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"  xmlns:v2="http://service.admin.ws.five9.com/v2/">
<soapenv:Header/>
<soapenv:Body>
  <v2:getCallLogReport>
     <!--Optional:-->
     <time>
        <!--Optional:-->
        <end>?</end>
        <!--Optional:-->
        <start>?</start>
     </time>
     <!--Optional:--> …
Run Code Online (Sandbox Code Playgroud)

php xml api soap

7
推荐指数
2
解决办法
6362
查看次数

标签 统计

api ×1

php ×1

soap ×1

xml ×1