1

这是我点击银行 API 的示例代码,不幸的是这个脚本不起作用

这是示例代码:

 <?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:CLERK"));
$result = curl_exec($ch);
curl_close($ch);

print_r($result);
?>

如果运行此代码,则会发生以下错误

HTTP/1.1 400 错误请求日期:2013 年 2 月 23 日星期六 05:24:10 GMT 服务器:Apache/2.2.23 (FreeBSD) mod_jk/1.2.37 mod_ssl/2.2.23 OpenSSL/0.9.8x 变化:接受编码连接: close Transfer-Encoding: chunked Content-Type: text/plain API 调用 (/api/rest/1.3/products/list) 需要缺少的参数:[site]1

4

2 回答 2

1

https://api.clickbank.com/rest/1.3/products

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.clickbank.com/rest/1.2/debug");
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:CLERK"));
$result = curl_exec($ch);
curl_close($ch);

print_r($result);
?>
于 2013-02-23T06:02:58.490 回答
0

所需的“站点”参数应该是 Clickbank ID(也称为供应商)。

于 2016-03-05T17:14:39.877 回答