stuartqwh (02-02-11)
Another bit of code, this time, the CJ API, you'll need a developer key from CJ:
I've added ALL the returned fields as variables, in case you want to use them in your code.PHP Code:<?php
$developerKey = "YOUR-DEVELOPER-KEY";
$websiteId = "YOUR-SITEID";
try {
$client = new SoapClient("https://product.api.cj.com/wsdl/version2/productSearchServiceV2.wsdl", array('trace'=> true));
$results = $client->search(array("developerKey" => $developerKey,
"websiteId" => $websiteId,
"advertiserIds" => '',
"keywords" => 'washing+machine',
"lowPrice" => '5',
"highPrice" => '1000',
"currency" => 'GBP',
"sortBy" => 'price',
"sortOrder" => 'asc',
"startAt" => 1,
"maxResults" => 10));
foreach($results->out->products->Product as $details)
{
$adId = $details->adId;
$advertiserId = $details->advertiserId;
$advertiserName = $details->advertiserName;
$buyUrl = $details->buyUrl;
$catalogId = $details->catalogId;
$currency = $details->currency;
$description = $details->description;
$imageUrl = $details->imageUrl;
$inStock = $details->inStock;
$isbn = $details->isbn;
$manufacturerName = $details->manufacturerName;
$manufacturerSku = $details->manufacturerSku;
$name = $details->name;
$price = $details->price;
$retailPrice = $details->retailPrice;
$salePrice = $details->salePrice;
$sku = $details->sku;
$upc = $details->upc;
echo '<a href="'.$buyUrl.'" target="_blank"><img style="float: left; margin: 10px; border: 1px solid #e4e4e4;" src="'.$imageUrl.'" alt="'.$name.'" width="200" /></a><strong>'.$name.'</strong> '.$description.'<br /><br />Brand: '.$manufacturerName.'<br /><br /><strong>'.$manufacturerName.' '.$name.'</strong><br /><br /><strong>£'.$price.'</strong><br /><a href="'.$buyUrl.'" target="_blank"><br /><img src="http://www.emmanie.co.uk/clickhere.png" alt="'.$name.'" border="0" /></a><hr style="clear:both;" />';
}
} catch (Exception $e){
echo "There was an error with your request or the service is unavailable.\n";
print_r ($e);
}
?>
This is what it should look like Washing Machines via CJ API
The trouble with the rat race is that even if you win you're still a rat.
Time passes. Listen. Time passes. Dylan Thomas
Ebay Alerts to your inbox
stuartqwh (02-02-11)
There are currently 2 users browsing this thread. (0 members and 2 guests)
Bookmarks