duanping1920 2016-02-12 03:38
浏览 62
已采纳

Neteller API REST API问题

I have an issue trying to implement Neteller's REST API. I have created my app in the merchant account (I don't have an SSL certificate in my site), I have a static IP for my web site and it is added to Neteller's allowed IP list, but for some reason I always receive a null response back from them.

This is my code:

$username = 'XXXXXXXXXXXXXXXX';
$password = 'XXxxxxxXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';

$curl = curl_init();

curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.neteller.com/v1/oauth2/token?grant_type=client_credentials");
curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type:application/json", "Cache-Control:no-cache"));
curl_setopt($curl, CURLOPT_POSTFIELDS, array("scope"=>"default"));
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

$serverOutput = curl_exec($curl);
$info = curl_getinfo($curl);

echo $serverOutput; // null response

Can anyone help me to solve this issue?

  • 写回答

1条回答 默认 最新

  • dousou1878 2016-04-20 13:07
    关注

    If you are receiving a null response to the curl_exec() method, this could indicate a problem establishing the HTTP connection.

    try adding:

    print_r(curl_errno($curl));
    

    This will return the curl error code, which you can then check against this list.

    Most probably it is a problem establishing the SSL connection - because the certificate issuing authority is not trusted by your cUrl installation. You can fix this by updating the trusted certificate authorities list. More info here.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?