首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >php中的Clickbank API?

php中的Clickbank API?
EN

Stack Overflow用户
提问于 2013-02-21 13:24:01
回答 2查看 3.1K关注 0票数 0

我需要从点击银行获得数码产品,所以我使用他们的API来获得产品,不幸的是,由他们给出的例子代码不工作,我使用CURL来做这件事,

代码如下:

代码语言:javascript
复制
<?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;

?>

但是我得到了下面的错误

代码语言:javascript
复制
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

以前有没有人遇到过这个错误?

EN

回答 2

Stack Overflow用户

发布于 2013-02-21 13:30:00

它需要一个名为site的参数。请在此处查看文档:https://api.clickbank.com/rest/1.3/products

票数 2
EN

Stack Overflow用户

发布于 2015-07-22 16:06:13

试试这个:

代码语言:javascript
复制
<?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;

    ?>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14995160

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档