【发布时间】:2013-02-08 20:31:50
【问题描述】:
这是我点击银行 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 变化:接受-Encoding Connection: close Transfer-Encoding: chunked Content-Type: text/plain API 调用 (/api/rest/1.3/products/list) 需要缺少的参数:[site]1
【问题讨论】:
-
需要缺少的参数:[site]1 - 您缺少调用的参数,看起来应该命名为“site”
-
嗨@Nicholas Pickering,我们可以在哪里传递参数“站点”,请给我一个示例代码?
-
嗨@Nicholas Pickering 什么是 [site]1 参数我怎么能得到它请解释
-
我已经为您写了一个答案 - 带有指向您正在使用的 API 的链接
标签: php xml api xmlhttprequest clickbank