Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- echo $whaturl;
- $ch = curl_init();
- //Set curl to return the data instead of printing it to the browser.
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- //Set the URL
- curl_setopt($ch, CURLOPT_URL, $whaturl);
- //Execute the fetch
- $data = curl_exec($ch);
- //Close the connection
- curl_close($ch);
- //echo $data;
- $amazonxml = new SimpleXMLElement($data);
- if ($amazonxml) {
- $xml = $amazonxml;
- $mark = $xml->TotalPages;
- $error = $xml->ErrorMsg;
- if ($xml->Items->Item) {
- $amazon_phrase= $AMAZON_PHRASE;
- //get first page of reviews
- $x=0;
- foreach ($xml->Items->Item as $item) {
- if ($x<$amazon_mr){
- if ( ($item->ItemAttributes->ListPrice->Amount > $AMAZON_THRESHOLD) || ($item->OfferSummary->LowestNewPrice->Amount > $AMAZON_THRESHOLD)) {
- $amimage = '';
- $amimage = $item->SmallImage->URL;
- if (strlen($amimage) < 1) {
- //$amimage = $MASTER_SITE."/".$FOLDER_NAME."/inc/pic.jpg";
- }
- $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.'" />';
- $content.="<b>" . $item->ItemAttributes->Title . "</b></a><br /><br />";
- $edreview =$item->EditorialReviews->EditorialReview->Content . "<br /><br />";
- // remove most html tags from amazon product description
- $edreview = strip_tags($edreview,'<p>,<b>,</b>,<br>, <br />,<strong>,</strong>') ;
- $edreview = str_replace('###',"",$edreview) ;
- $content.=$edreview;
- $content.="<div style=\"clear:both\"></div><br />";
- //echo $content;
- $x=$x+1;
- }}}
- if (strlen($content) > $amazon_mr) {
- $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.'&l=ur2&o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></div>';
- }
- }
- $amazon_content=$content;
- $content.="</div>";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement