2014-06-05 156 views
0

嗨,我想使用popfax API,但我始終接收電子郵件複雜的錯誤Popfax API肥皂PHP

<?php 
ini_set("soap.wsdl_cache_enabled", "0"); 
$username = '[email protected]'; 
$password = 'password'; 
$usernameToken = array('email' => $username,'password' => $password); 
$wsse_ns = "http://schemas.xmlsoap.org/ws/2002/07/secext"; 
$SoapVarUser = new SoapVar($username, XSD_STRING, NULL, $wsse_ns, NULL, $wsse_ns); 
$SoapVarPass = new SoapVar($password, XSD_STRING, NULL, $wsse_ns, NULL, $wsse_ns); 
$wsse_auth = new SoapVar($usernameToken, SOAP_ENC_OBJECT, NULL, $wsse_ns, 'AuthenticationHeader', $wsse_ns); 
$header=new SoapVar($wsse_auth, SOAP_ENC_OBJECT, NULL, $wsse_ns, 'Security', $wsse_ns); 
$wsse_header = new SoapHeader($wsse_ns, 'AuthenticationHeader', $header, true); 
$wsdl = "https://api3.popfax.com/?service=Popfax&wsdl"; 
$client = new SoapClient($wsdl, array("trace" => 1)); 
$client->__setSoapHeaders(array($wsse_header)); 
$response = $client->__SoapCall('PopfaxService.getAccountInfo',array()); 
var_dump($response); 
?> 

但是當我運行這個PHP代碼出現此錯誤:

PHP Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Client] Error 107 in /home/diogopms/public_html/sapo/popfax.php:17 
Stack trace: 
#0 /home/diogopms/public_html/sapo/popfax.php(17): SoapClient->__soapCall('PopfaxService.g...', Array) 
#1 {main} 
    thrown in /home/diogopms/public_html/sapo/popfax.php on line 17 

回答

1

密碼發送到服務器必須MD5哈希。請參閱Popfax API文檔。

$password = md5('yourpassword'); 
+0

感謝其解決我的問題:) – diogopms