简体   繁体   English

PHP中的Clickbank API?

[英]Clickbank API in php?

i need to get digital products from click bank, so am using their API to get products, unfortunately given example code given by them are not working, am using CURL to do this , 我需要从Click Bank获得数字产品,因此正在使用其API来获取产品,不幸的是,他们给出的示例代码无法正常工作,正在使用CURL来做到这一点,

code is below : 代码如下:

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://api.clickbank.com/rest/1.3/products/list");
curl_setopt($ch, CURLOPT_HEADER, true); 
curl_setopt($ch, CURLOPT_HTTPGET, 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;

?>

but i got the below error 但我收到以下错误

HTTP/1.1 400 Bad Request Date: Thu, 21 Feb 2013 05:20:47 GMT Server: Apache/2.2.23 (FreeBSD) mod_jk/1.2.37 mod_ssl/2.2.23 OpenSSL/0.9.8x Vary: Accept-Encoding Connection: close Transfer-Encoding: chunked Content-Type: text/plain The API call (/api/rest/1.3/products/list) requires parameters which are missing : [site]1

have any one got this error before ? 有人遇到过这个错误吗?

It's expecting a parameter called site. 期望有一个称为site的参数。 Please see the docs here: https://api.clickbank.com/rest/1.3/products 请在此处查看文档: https : //api.clickbank.com/rest/1.3/products

Try This: 尝试这个:

<?php
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,"https://api.clickbank.com/rest/1.3/products/list?site=<your unique affiliate id>");
    curl_setopt($ch, CURLOPT_HEADER, true); 
    curl_setopt($ch, CURLOPT_HTTPGET, 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;

    ?>

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

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