简体   繁体   English

Rest-ClickBank沙箱发布API不起作用

[英]Rest-ClickBank sandbox post api not working

I am trying to use Sandbox Api of clickBank which accepts a post request. 我正在尝试使用clickBank的Sandbox Api接受发布请求。 But somehow it doesnot work. 但是以某种方式它不起作用。

I am calling clickBank's Prepare Api (https://sandbox.clickbank.com/rest/1.2/sandbox/prepare) using a POST method. 我正在使用POST方法调用clickBank的Prepare Api(https://sandbox.clickbank.com/rest/1.2/sandbox/prepare)。

But it giving me this error HTTP/1.1 405 Method Not Allowed Date: Wed, 07 Nov 2012 12:08:32 GMT Server: Apache/2.2.22 (FreeBSD) mod_jk/1.2.32 mod_ssl/2.2.22 OpenSSL/0.9.8q Allow: POST,OPTIONS Content-Length: 1034 Content-Type: text/html;charset=utf-8 1 但是它给了我这个错误HTTP / 1.1 405不允许的方法日期:2012年11月7日星期三12:08:32 GMT服务器:Apache / 2.2.22(FreeBSD)mod_jk / 1.2.32 mod_ssl / 2.2.22 OpenSSL / 0.9。 8q允许:POST,OPTIONS内容长度:1034内容类型:text / html; charset = utf-8 1

Here is my code. 这是我的代码。

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://sandbox.clickbank.com/rest/1.2/sandbox/prepare");
curl_setopt($ch, CURLOPT_HEADER, true); 
curl_setopt($ch, CURLOPT_POST, true); 
curl_setopt($ch, CURLOPT_NOBODY, true);
//curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/xml", "Authorization:". $dev_key .":" .$api_key ));
$result = curl_exec($ch);
curl_close($ch);
print $result;

I tried everything but it doesnot seem to work. 我尝试了一切,但似乎没有用。 Any help would be highly appreciated. 任何帮助将不胜感激。

Thanks in Advance. 提前致谢。

Try adding this before your curl_exec() : 尝试在curl_exec()之前添加它:

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');

It worked for me, I hope it will work for you too. 它对我有用,我希望它也对您有用。

Try this : 尝试这个 :

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://sandbox.clickbank.com/rest/1.3/sandbox/prepare");

curl_setopt($ch, CURLOPT_HEADER, false);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept:application/json", "Authorization: >>>Your Clickbank Developer API Key from ClickBan->Settings->My Account<<<"));

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');

$return = curl_exec($ch);

curl_close($ch);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM