【问题标题】:Rest-ClickBank sandbox post api not workingRest-ClickBank 沙箱发布 api 不起作用
【发布时间】:2012-10-27 12:23:32
【问题描述】:

我正在尝试使用 clickBank 的 Sandbox Api 来接受发布请求。 但不知何故,它不起作用。

我正在使用 POST 方法调用 clickBank 的 Prepare Api (https://sandbox.clickbank.com/rest/1.2/sandbox/prepare)。

但它给了我这个错误 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

这是我的代码。

$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;

我尝试了所有方法,但似乎不起作用。 任何帮助将不胜感激。

提前致谢。

【问题讨论】:

    标签: php rest curl clickbank


    【解决方案1】:

    试试这个:

    $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);
    

    【讨论】:

      【解决方案2】:

      尝试在您的 curl_exec() 之前添加此内容:

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

      它对我有用,我希望它也对你有用。

      【讨论】:

        猜你喜欢
        • 2015-12-12
        • 2021-07-18
        • 2019-03-12
        • 2017-12-14
        • 2015-10-18
        • 1970-01-01
        • 2015-05-09
        • 2019-03-21
        • 2017-09-23
        相关资源
        最近更新 更多