Advertisement
Guest User

Untitled

a guest
Aug 6th, 2012
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.99 KB | None | 0 0
  1. echo $whaturl;
  2.  
  3. $ch = curl_init();
  4. //Set curl to return the data instead of printing it to the browser.
  5. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  6. //Set the URL
  7. curl_setopt($ch, CURLOPT_URL, $whaturl);
  8. //Execute the fetch
  9. $data = curl_exec($ch);
  10. //Close the connection
  11. curl_close($ch);
  12. //echo $data;
  13. $amazonxml = new SimpleXMLElement($data);
  14. if ($amazonxml) {
  15. $xml = $amazonxml;
  16. $mark = $xml->TotalPages;
  17. $error = $xml->ErrorMsg;
  18.  
  19. if ($xml->Items->Item) {
  20. $amazon_phrase= $AMAZON_PHRASE;
  21.  
  22. //get first page of reviews
  23. $x=0;
  24. foreach ($xml->Items->Item as $item) {
  25. if ($x<$amazon_mr){
  26. if ( ($item->ItemAttributes->ListPrice->Amount > $AMAZON_THRESHOLD) || ($item->OfferSummary->LowestNewPrice->Amount > $AMAZON_THRESHOLD)) {
  27. $amimage = '';
  28. $amimage = $item->SmallImage->URL;
  29. if (strlen($amimage) < 1) {
  30. //$amimage = $MASTER_SITE."/".$FOLDER_NAME."/inc/pic.jpg";
  31. }
  32.  
  33.  
  34. $content.='<a href="'.$item->DetailPageURL.'"target="_blank" title="'.$item->ItemAttributes->Title.'"><img border="0" src="'. $amimage.'" style="margin-right:10px;" align="left" alt="'.$item->ItemAttributes->Title.'" />';
  35. $content.="<b>" . $item->ItemAttributes->Title . "</b></a><br /><br />";
  36. $edreview =$item->EditorialReviews->EditorialReview->Content . "<br /><br />";
  37. // remove most html tags from amazon product description
  38. $edreview = strip_tags($edreview,'<p>,<b>,</b>,<br>, <br />,<strong>,</strong>') ;
  39. $edreview = str_replace('###',"",$edreview) ;
  40. $content.=$edreview;
  41. $content.="<div style=\"clear:both\"></div><br />";
  42. //echo $content;
  43. $x=$x+1;
  44. }}}
  45. if (strlen($content) > $amazon_mr) {
  46. $content.='<div align="right"><br /><a href="http://www.amazon.com/gp/search?ie=UTF8&keywords='.$SafeQuery.'&tag='.$AMAZON_ASSOCTAG.'&index=blended&linkCode=ur2&camp=1789&creative=9325" target="_blank">Find more '.ucwords($theproduct).' on Amazon</a><img src="http://www.assoc-amazon.com/e/ir?t='.$AMAZON_ASSOCTAG.'&amp;l=ur2&amp;o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></div>';
  47. }
  48.  
  49. }
  50. $amazon_content=$content;
  51. $content.="</div>";
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement