2011-09-26 34 views
2

我試圖使用PHP Curl庫連接到Experian的API。來自Experian API的TTY和/或ARF響應

當我向Experian發送HTTPS請求時,我得到一個HTTP 200 OK響應,但沒有更多。我期待TTY或ARF的迴應。有誰知道我做錯了什麼?

這裏是我下面的代碼,以供參考片段

$ch = curl_init(); 
curl_setopt($ch,CURLOPT_URL,'http://stg1.experian.com/lookupServlet1?lookupServiceName=AccessPoint&lookupServiceVersion=1.0&serviceName=NetConnectDemo&serviceVersion=2.0&responseType=text/plain'); //not the actual site 

//For Debugging 
curl_setopt($ch, CURLOPT_VERBOSE, TRUE); 
curl_setopt($ch, CURLOPT_TIMEOUT,60); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); 
curl_setopt($ch, CURLOPT_POST,1); 


//#2-Net Connect client receives ECALS response. This is the Net Connect URL. 

$ecals_url = curl_exec($ch); 

//#3-Net Connect client validates that the URL ends with 「.experian.com」. If the URL is valid, the processing continues; otherwise, processing ends. 

$host_name = parse_url($ecals_url); 
$host_name = explode(".", $host_name['host']); 
$host_name = $host_name[1].'.'.$host_name[2]; 

if($host_name == "experian.com") 
{ 

    //#4-Net Connect client connects to Experian using URL returned from ECALS. 
    echo "step 4 - connect to secure connection<br>"; 

    curl_setopt($ch, CURLOPT_VERBOSE, TRUE); 
    curl_setopt($ch,CURLOPT_URL,$ecals_url); 
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); 
    curl_setopt($ch,CURLOPT_USERPWD,"$username:$password"); 
    curl_setopt($ch,CURLOPT_CERTINFO,1); 
    curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,1); 
    curl_setopt($ch, CURLOPT_TIMEOUT, 10); //times out after 10s 
    curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1); 
    curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); 
    curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); 
      curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 

    $result = curl_exec ($ch); 
    print_r ($result); 
+0

你能分享最終的代碼嗎?我們也有這個問題。 – Glyph

回答

1

,因爲我與我們的百利網絡連接服務搞砸它已經有一段時間,但我相信你有Base64編碼的用戶名,因爲他們的系統密碼值接受它。