//This file requires PHP version 5.0 or later Product Search

Commission Junction Demo Product Search


true)); // call the service with the appropriate variables, remember developer key is required $results = $client->search( $developerKey = 'put developer key here ', $websiteId = 'put websiteID here', $advertiserIds, $keywords = $_GET['keywords'], $serviceableArea, $upcOrIsbnOrEan, $manufacturerName, $advertiserSku, $lowPrice, $highPrice, $currency, $sortBy, $orderIn, $startAt = 0, $maxResults = 10 ); // give the user a nice message about the results print "

Your search for '$keywords' generated $results->totalPossible results

"; // iterate through the results and display them to the user echo '
'; foreach ($results->products as $product) { // format the price so that it is consistant $price = sprintf('%01.2f', $product->price); echo "

$product->name
Offered by $product->advertiserName at $price ($product->currency)

"; echo "
"; } echo '
'; // if something goes wrong show the user a nice message // } catch (Exception $e){ // // echo "

There was an error with your request or the service is unavailable.

"; // // print_r ($e); // } ?>