简体   繁体   中英

how to use clickbank api's in php?

I am trying to use prepare method of sandbox api of clickbank.

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"

I have tried lots of another methods but it always gives me 404 or 403 or 500 http error.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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