CARA BUild AGC AMAZON & ADSENSE DI BLOG WORDPRESS MENGGUNAKAN SCRIPT PHP
Setelah Melalui beberapa test, dan saya lihat script ini berhasil dengan baik. walaupun Script AGC Amazon yang model beginian bukan hal yang baru, jika anda pemain Amazon affiliate baik lama ataupun baru, saya kira methode ini perlu di coba. siapa tahu bisa menambah pundi-pundi Dollar agan.. hehehehe....
Selanjutnya Langsung saja copas beberapa script di bawah ini:
<?php
function amagc($tag, $api, $secretkey, $region, $department, $query)
{
$time = time() + 10000;
$method = 'GET';
$host = 'webservices.amazon.'.$region;
$uri = '/onca/xml';
$slug["Service"] = "AWSECommerceService";
$slug["Operation"] = "ItemSearch";
$slug["SubscriptionId"] = $api;
$slug["AssociateTag"] = $tag;
$slug["SearchIndex"] = 'All';
$slug["Condition"] = 'All';
$slug["Keywords"] = $query;
$slug["TruncateReviewsAt"] = '500'; // silahkan ganti sesuai keinginan
$slug["ResponseGroup"] = 'Images,ItemAttributes,EditorialReview'; // Silahkan check di Amazon API Untuk mengganti scheme responnya.
$slug["Timestamp"] = gmdate("Y-m-d\TH:i:s\Z",$time);
$slug["Version"] = "2011-08-01";
ksort($slug);
$query_slug = array();
foreach ($slug as $slugs=>$value)
{
$slugs = str_replace("%7E", "~", rawurlencode($slugs));
$value = str_replace("%7E", "~", rawurlencode($value));
$query_slug[] = $slugs."=".$value;
}
$query_slug = implode("&", $query_slug);
$signinurl = $method."\n".$host."\n".$uri."\n".$query_slug;
$signature = base64_encode(hash_hmac("sha256", $signinurl, $secretkey, True));
$signature = str_replace("%7E", "~", rawurlencode($signature));
$request = "http://".$host.$uri."?".$query_slug."&Signature=".$signature;
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Konqueror/4.0; Microsoft Windows) KHTML/4.0.80 (like Gecko)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $request);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
?>
function amagc($tag, $api, $secretkey, $region, $department, $query)
{
$time = time() + 10000;
$method = 'GET';
$host = 'webservices.amazon.'.$region;
$uri = '/onca/xml';
$slug["Service"] = "AWSECommerceService";
$slug["Operation"] = "ItemSearch";
$slug["SubscriptionId"] = $api;
$slug["AssociateTag"] = $tag;
$slug["SearchIndex"] = 'All';
$slug["Condition"] = 'All';
$slug["Keywords"] = $query;
$slug["TruncateReviewsAt"] = '500'; // silahkan ganti sesuai keinginan
$slug["ResponseGroup"] = 'Images,ItemAttributes,EditorialReview'; // Silahkan check di Amazon API Untuk mengganti scheme responnya.
$slug["Timestamp"] = gmdate("Y-m-d\TH:i:s\Z",$time);
$slug["Version"] = "2011-08-01";
ksort($slug);
$query_slug = array();
foreach ($slug as $slugs=>$value)
{
$slugs = str_replace("%7E", "~", rawurlencode($slugs));
$value = str_replace("%7E", "~", rawurlencode($value));
$query_slug[] = $slugs."=".$value;
}
$query_slug = implode("&", $query_slug);
$signinurl = $method."\n".$host."\n".$uri."\n".$query_slug;
$signature = base64_encode(hash_hmac("sha256", $signinurl, $secretkey, True));
$signature = str_replace("%7E", "~", rawurlencode($signature));
$request = "http://".$host.$uri."?".$query_slug."&Signature=".$signature;
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Konqueror/4.0; Microsoft Windows) KHTML/4.0.80 (like Gecko)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $request);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
?>
Selanjutnya Untuk Memanggilnya silahkan copy Script berikut ini:
<?php
$tag = 'kode_affiliate_amazon_agan';
$api = 'API_KEY_agan';
$secretkey = 'Secret_Key';
$region = 'com'; // com, ca, de, dan lain-lain
$query = get_search_query(); // Jika agan memanggilnya lewat Search Page di WordPress
$department = 'All'; // Silahkan Pilih sendiri department yang mau di Grab
$agc = amagc($tag, $api, $secretkey, $region, $department, $query);
if(@simplexml_load_string($agc))
{
$xmlin = simplexml_load_string($agc);
if(!empty($xmlin))
{
$Total = $xmlin->Items->TotalResults;
$xmls = $xmlin->Items->Item;
foreach($xmls as $xml)
{
$AmaTitle = $xml->ItemAttributes->Title;
$AmaThumb = $xml->SmallImage->URL;
$AmaAsin = $xml->ASIN;
$AmaLink = $xml->DetailPageURL;
$AmaStock = $xml->ItemAttributes->NumberOfItems;
$AmaBind = $xml->ItemAttributes->Binding;
$AmaBrand = $xml->ItemAttributes->Brand;
$AmaDept = $xml->ItemAttributes->Department;
$AmaEAN = $xml->ItemAttributes->EAN;
$AmaListPrice = $xml->ItemAttributes->ListPrice->FormattedPrice;
$AmaCurrency = $xml->ItemAttributes->ListPrice->CurrencyCode;
$AmaDescription = $xml->EditorialReviews->EditorialReview->Content;
echo '<h2>'.$AmaTitle.'</h2>' . "\n";
echo '<div class="entry-thumb">' . "\n";
echo '<img src="'.$AmaThumb.'" data-src="'.$AmaThumb.'" width="'.$xml->SmallImage->Width.'" height="'.$xml->SmallImage->Height.'" class="alignleft" alt="'.$AmaTitle.'" />' . "\n";
echo '</div>' . "\n";
echo '<div class="entry-details">' . "\n";
echo '<p>Price: '.$AmaListPrice.'</p>' . "\n";
echo '<p>Currency: '.$AmaCurrency.'</p>' . "\n";
echo '<p>Department: '.$AmaDept.'</p>' . "\n";
echo '<p>Brand: '.$AmaBrand.'</p>' . "\n";
echo '<p><a title="'.$AmaTitle.'" href="'.$AmaLink.'" rel="nofollow" target="_blank">Buy Now</a></p>' . "\n";
echo '</div><div class="clear"></div>' . "\n";
echo '<ol>' . "\n";
foreach($xml->ItemAttributes->Feature as $feature)
{
echo '<li>'.$feature.'</li>' . "\n";
}
echo '</ol>' . "\n";
echo $AmaDescription.'' . "\n";
}
}
}
?>
$tag = 'kode_affiliate_amazon_agan';
$api = 'API_KEY_agan';
$secretkey = 'Secret_Key';
$region = 'com'; // com, ca, de, dan lain-lain
$query = get_search_query(); // Jika agan memanggilnya lewat Search Page di WordPress
$department = 'All'; // Silahkan Pilih sendiri department yang mau di Grab
$agc = amagc($tag, $api, $secretkey, $region, $department, $query);
if(@simplexml_load_string($agc))
{
$xmlin = simplexml_load_string($agc);
if(!empty($xmlin))
{
$Total = $xmlin->Items->TotalResults;
$xmls = $xmlin->Items->Item;
foreach($xmls as $xml)
{
$AmaTitle = $xml->ItemAttributes->Title;
$AmaThumb = $xml->SmallImage->URL;
$AmaAsin = $xml->ASIN;
$AmaLink = $xml->DetailPageURL;
$AmaStock = $xml->ItemAttributes->NumberOfItems;
$AmaBind = $xml->ItemAttributes->Binding;
$AmaBrand = $xml->ItemAttributes->Brand;
$AmaDept = $xml->ItemAttributes->Department;
$AmaEAN = $xml->ItemAttributes->EAN;
$AmaListPrice = $xml->ItemAttributes->ListPrice->FormattedPrice;
$AmaCurrency = $xml->ItemAttributes->ListPrice->CurrencyCode;
$AmaDescription = $xml->EditorialReviews->EditorialReview->Content;
echo '<h2>'.$AmaTitle.'</h2>' . "\n";
echo '<div class="entry-thumb">' . "\n";
echo '<img src="'.$AmaThumb.'" data-src="'.$AmaThumb.'" width="'.$xml->SmallImage->Width.'" height="'.$xml->SmallImage->Height.'" class="alignleft" alt="'.$AmaTitle.'" />' . "\n";
echo '</div>' . "\n";
echo '<div class="entry-details">' . "\n";
echo '<p>Price: '.$AmaListPrice.'</p>' . "\n";
echo '<p>Currency: '.$AmaCurrency.'</p>' . "\n";
echo '<p>Department: '.$AmaDept.'</p>' . "\n";
echo '<p>Brand: '.$AmaBrand.'</p>' . "\n";
echo '<p><a title="'.$AmaTitle.'" href="'.$AmaLink.'" rel="nofollow" target="_blank">Buy Now</a></p>' . "\n";
echo '</div><div class="clear"></div>' . "\n";
echo '<ol>' . "\n";
foreach($xml->ItemAttributes->Feature as $feature)
{
echo '<li>'.$feature.'</li>' . "\n";
}
echo '</ol>' . "\n";
echo $AmaDescription.'' . "\n";
}
}
}
?>
Saya kira cukup sekian tutorial atau Cara Membuat AGC Amazon Di Blog Wordpress Atau PHP kali ini, semoga dapat memberikan manfaat dan menambah pengalaman anda semua. jika ada yang kurang jelas, untuk Demo AGC nya Seperti ini http://bit.ly/1Ucj0rC
BERITA LENGKAP DI HALAMAN BERIKUTNYA
Halaman Berikutnya
0 Response to "CARA BUild AGC AMAZON & ADSENSE DI BLOG WORDPRESS MENGGUNAKAN SCRIPT PHP"
Post a Comment