2

I am working in click bank API.In that API, I want to display product list for that API.I am beginner in click bank API.

For example

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://api.clickbank.com/rest/1.3/products/");
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-DEVAPIKEY:API-CLERKAPIKEY"));
$result = curl_exec($ch);
curl_close($ch);

print $result;

How to solve it.Please advice me ASAP.

rinchik
  • 2,642
  • 8
  • 29
  • 46
  • 2
    Waht do you want in your output? what does $result print? – Engineer Feb 21 '13 at 09:51
  • u r getting this error message ah ?HTTP/1.1 406 Not Acceptable Date: Thu, 21 Feb 2013 09:56:34 GMT Server: Apache/2.2.23 (FreeBSD) mod_jk/1.2.37 mod_ssl/2.2.23 OpenSSL/0.9.8x Content-Length: 1112 Vary: Accept-Encoding Content-Type: text/html;charset=utf-8 –  Feb 21 '13 at 09:57

2 Answers2

1

try

curl_setopt($ch, CURLOPT_URL,"https://api.clickbank.com/rest/1.3/products/list");
Stacey Richards
  • 6,536
  • 7
  • 38
  • 40
  • 2
    HTTP/1.1 400 Bad Request Date: Thu, 21 Feb 2013 10:07:46 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 –  Feb 21 '13 at 10:08
  • 1
    I just copy/pasted the original url into my browser and a page was returned with a description of the API. the https://api.clickbank.com/rest/1.3/products/list call was described as returning the product list. I tried it and got an access denied result but I would assume if I was logged in it would return all products (as the description specified). – Stacey Richards Feb 21 '13 at 10:09
  • 1
    hi @Stacey Richards copy/paste this url in our browser but Access is denied messages are shown in our browser –  Feb 21 '13 at 10:12
  • 2
    You probably need the Authorization: header in the request which won't be included if you copy/paste url in your browser. Could you try putting a space between "Authorization:" and "DEV-..." in your curl request (as well as appending "/list" to the requested url). – Stacey Richards Feb 21 '13 at 10:17
  • 1
    Hi @Stacey Richards i facing this error HTTP/1.1 400 Bad Request Date: Thu, 21 Feb 2013 10:26:10 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 how to solve it please guide me.... –  Feb 21 '13 at 10:27
  • 1
    You need to include the 'site' parameter. So try api.clickbank.com/rest/1.3/products/list?site=your_site_parameter where your_site_parameter is your site parameter. – Stacey Richards Feb 21 '13 at 10:38
  • 1
    Hi @Stacey Richards your_site_parameter means domain name? or any ? –  Feb 21 '13 at 10:57
  • 1
    I don't know. All I know is that the documentation at api.clickbank.com/rest/1.3/products specifies that the site parameter is required. I would imagine that you should have been issued with, or have created, a site parameter. You need to add that site parameter to your request before it will work. – Stacey Richards Feb 21 '13 at 11:01
  • Hi need sample code for click bank API product list php example? –  Feb 22 '13 at 04:19
0

I believe the products API is only for your products as a seller, and i don't think it will give you all the products on the marketplace (if that is what you are after). I ran into a similar problem, but in the past I found there is a way to download the entire marketplace in .zip format.

https://support.clickbank.com/hc/en-us/articles/220376547-Marketplace-Feed

Brandon Johnson
  • 329
  • 5
  • 11