简体   繁体   English

如何在PHP中使用Clickbank API?

[英]how to use clickbank api's in php?

I am trying to use prepare method of sandbox api of clickbank. 我正在尝试使用clickbank沙盒api的准备方法。

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);`enter code here`
       curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
       curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/xml","Authorization:DEV-  9B0D426BC6C70C4618F37D41B7E01877E731:API-D34454EDE1D2D8F45A62588CBF1DDC6B29B2"));

       $result = curl_exec($ch);
       curl_close($ch);

      print $result;
   ?>

but it gives me this error 但这给了我这个错误

"HTTP/1.1 500 Internal Server Error Date: Fri, 15 Jun 2012 11:30:18 GMT Server: Apache/2.2.22 (FreeBSD) mod_jk/1.2.32 mod_ssl/2.2.22 OpenSSL/0.9.8q Content-Length: 409 Connection: close Content-Type: text/html Internal Server Error1" “ HTTP / 1.1 500内部服务器错误日期:2012年6月15日星期五,格林尼治标准时间服务器:Apache / 2.2.22(FreeBSD)mod_jk / 1.2.32 mod_ssl / 2.2.22 OpenSSL / 0.9.8q内容长度: 409连接:关闭内容类型:text / html内部服务器错误1“

I have tried lots of another methods but it always gives me 404 or 403 or 500 http error. 我尝试了很多其他方法,但始终会出现404或403或500 http错误。

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: DEV-9B0D426BC6C70C4618F37D41B7E01877E731"));

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