'.$queryUrl.'
'; $request=simplexml_load_file($queryUrl) or die ("xml response not loading"); if($request->Items->TotalResults > 0) { // we have at least one response //set Amazon xml values as specifc variables to be printed out below $image = $request->Items->Item->MediumImage->URL; if (empty($image)) { $image = '* Image Not Available'; } $title = $request->Items->Item->ItemAttributes->Title; $author = $request->Items->Item->ItemAttributes->Author; //simple logic check for author and director values, shows if (strlen($author) > 2) { $creator = $author; } elseif (empty($author)) { $creator = $request->Items->Item->ItemAttributes->Director; } else { $creator = '* Creator Not Available'; } $asin = $request->Items->Item->ASIN; $uri = $request->Items->Item->DetailPageURL; $editorialReview = $request->Items->Item->EditorialReviews->EditorialReview->Content; $CustomerReviews = $request->Items->Item->CustomerReviews->IFrameURL; //print out Amazon xml values as html echo ''.$title.'
'."\n"; echo ''.$creator.'
ID (isbn or asin): '.$asin .'
Get full details
Editorial review: '.html_entity_decode($editorialReview).'
'."\n"; echo 'You might also like...
'."\n"; echo '- '."\n";
foreach ($request->Items->Item->SimilarProducts->SimilarProduct as $related) {
echo '
- '.html_entity_decode($related->Title).' '."\n"; echo '
- ID (isbn or asin): '.$related->ASIN.' '."\n"; } echo '
"; var_dump($request); echo ""; } else { //no search results echo '
No results for your query for "'.$q.'"
'; } else: //show form and allow the user to check for Amazon.com reviews and more ?>