Reputation: 31
Hello i want to get the product lists from cj, clickbank and linkshare via API's to display the whole lists on my site , if this is possible or its a nightmare , where am i standing please generous reply is needed, tell me how to grab the product list using their respective API's , i have found alot of blogs and posts regarding this but none is enough to solve my prob, thats y i said a nightmare.
this is what i got for clickbank
$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-7979307A05A8A50B6535A5AD5DCD8EDB060B:API-4D297E18498B51B70EA986DC7422B1BCE488"));
$result = curl_exec($ch);
curl_close($ch);
print_r($result);
the apikey and dev key is the real one of my affiliate account i created , i am giving the real info because i need it to be done, it is throwing the same error , site parameter is missing,
same is what i want for the other two.
much thanks in advance . cheers.
Upvotes: 2
Views: 2717
Reputation: 31
Okey , that question i posted was somewhat one and half month before , i know answers are present all around the web but scattered and i want them to be gathered so if some one need it can use it.
first of all i am giving you for CJ, Comission Junction: 1) Creat a page e.g cjcall.php and put the following code on that page.
// CJ Product Grabing cjcall.php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://product-search.api.cj.com/v2/product-search?website-id=YOUR-SITE-ID&keywords=KEYWORD&records-per-page=30&serviceable-area=US");
curl_setopt($ch, CURLOPT_HEADER,false);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/xml", "Authorization:YOUR-CJ-DEVELOPER-ID"));
$result = curl_exec($ch);
THIS will give you responce of products against your keyword if it is matching products.
you can get you result the way you want i figured it this way that i created a new page called cjcronjob.php and put the following code on that page and run it , there you can use the product details, i.e may be save in the database.
//cjcronjob.php
$homepage = file_get_contents('ABSOLUTE-PATH-TO-THE-FIRST-CJCALL.PHP-FILE/cjcall.php');
$object = simplexml_load_string($homepage);
foreach($object->products->product as $cjres)
{
}
nOW each product is in your control use it in here inside the foreach loop which will run twenty times here as specified in the curl call. clickbank is still a mystery , may be they dont allow you to perform more against their API
Upvotes: 0
Reputation: 31
okey the second was linkshare product grabing from linkshare , which is a bit different than other affiliate channels, in a sence that here first you will create relation on the linkshare advertisers , and you can the products of those who will allow you to be his advertiser or affiliate:
here is the code:
$ch = curl_init();
$cv = curl_version();
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HTTPGET, TRUE);
curl_setopt($ch, CURLOPT_URL, "http://productsearch.linksynergy.com/productsearch?token=YOUR-LINKSHARE-TOKEN-ID-A-VERY-LONG-STRING&keyword=%22YOUR-KEYWORD%22&MaxResults=20&pagenumber=1&mid=MID-THE-ID-OF-THE-ADVERTIZER-WHO-HAS-ALLOWED-YOU&sort=retailprice&sorttype=asc&sort=productname&sorttype=asc");
$xml_data = curl_exec($ch);
curl_close($ch);
$object = simplexml_load_string($xml_data);
foreach($object->item as $signprod)
{}
under the foreach loop you can do what ever you want, just print_r($signprod) and you will get the details , put the keyword matching against your allowed advertiser's product, by helping you more say i have a relation with some cookies site, who's MID is xxxxx , then i write cookies in the keyword and it get results for me, do accordingly. its simple and yeah it will take a long time on net if someone is new like me, which i was before more than a month ago.
Upvotes: 0