【问题标题】:How to list out product details from click bank API and XML?如何从点击银行 API 和 XML 中列出产品详细信息?
【发布时间】: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


【解决方案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);
?>

【讨论】:

  • 嗨@ Nicholas Pickering 替换此代码后出现错误 HTTP/1.1 403 禁止日期:星期六,2013 年 2 月 23 日 06:34:17 GMT 服务器:Apache/2.2.23 (FreeBSD) mod_jk/1.2 .37 mod_ssl/2.2.23 OpenSSL/0.9.8x 变化:Accept-Encoding Transfer-Encoding: chunked Content-Type: text/plain 访问帐户被拒绝1请帮助我
  • 您是否将 www.domain.com 替换为您网站的 URL?
  • @krishna 如果没有,请告诉我。
  • @krishna 现在运行我编辑的答案中的代码,而不是你的代码,然后告诉我你得到了什么。
  • 嗨@Nicholas Pickering 替换此脚本以下信息已显示标题参数:参数:主机,值:api.clickbank.com 参数:接受,值:应用程序/xml 参数:授权,值:DEV- 0AA0863B00D0C8E3E4AAE3D39C59836B3333:API-189A6471A02308B646DFF780C015D2322FBB 参数:内容长度,值:0 请求参数:1 请帮帮我
【解决方案2】:

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

【讨论】:

    猜你喜欢
    • 2013-02-06
    • 1970-01-01
    • 2022-01-22
    • 2012-05-28
    • 1970-01-01
    • 2013-04-19
    • 1970-01-01
    • 2015-01-03
    • 1970-01-01
    相关资源
    最近更新 更多