Sport Motorcycles Motorcycle Modif Motorcycle News Beauty Motorcycles Sexy Motorcycle
Next motorcycles Racer Motorcycle Latest Motorcycle Old Motorcycles Sexy Bikers
Super motorcycles Motorcycle Performance Max Bikers Rallies Motorcycles Motorcycle Hot Girl

p

Friday, April 22, 2011

Cara Bikin Auto Generate Content di Halaman Search WordPress

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWEsCT1gnLNs4Nayb2t-KZycUxSwl6nKfZSlxXKq2t73yJ8bAxtSVdy-6LU-FIDhF4bae0_IXQukZ3yN4B49Sr9WHLJ5PheYI4SnLoQ0MA7IRYSFlrybq7AYIA-g-tpOq-ogypBCWYil-i/s1600/google3.jpg 
Ihsan Magazine - Cara Bikin Auto Generate Content di Halaman Search WordPress – Demam blog auto generate content atau yang sering disingkat blog AGC dimulai kurang lebih 1 atau 2 tahun yang lalu. Terlepas dari banyaknya pro dan kontra kehadiran blog AGC seakan tidak dapat dibendung, walaupun sudah banyak yang menjadi korban setelah membuat blog AGC 2 – 3 bulan kemudian di banned oleh google kehadiran blog-blog AGC yang lain semakin banyak menghiasi mesin pencari baik google, yahoo maupun bing, ibarat pepatah mati 1 tumbuh seribu . . .

Artikel  Cara Bikin Auto Generate Content di Halaman Search WordPress ini jujur aku copas dari salah satu master AGC yaitu mas ADIPRAMANA yang memberikan ilmunya ini secara gratis, langsung aja bagi yang ingin belajar Cara Bikin Auto Generate Content di Halaman Search WordPress berikut kodenya :
Kode 1 (Script proses keyword) – Buka search.php dan tempatkan Kode berikut di paling atas sebelum kode
define(‘BING_API_KEY’, ”);
define(‘YAHOO_API_KEY’, ”);
define(‘GOOGLE_API_KEY’, ”);
function pete_curl_get($url, $params){$post_params = array();
foreach ($params as $key => &$val) {
if (is_array($val)) $val = implode(‘,’, $val);
$post_params[] = $key.’=’.urlencode($val);
}
$post_string = implode(‘&’, $post_params);
$fullurl = $url.”?”.$post_string;
$ch = curl_init();curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);curl_setopt($ch, CURLOPT_URL, $fullurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, ‘Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040608′); //kamu bisa pake user agent yang lain, lihat listnya di sini www.user-agents.org
$result = curl_exec($ch);curl_close($ch);
return $result;
}
function perform_bing_web_search($termstring){$searchurl = ‘http://api.bing.net/json.aspx?’;
$searchurl .= ‘AppId=’.'ABCDEFG’; //ganti ABCDEFG dengan kode api BING http://www.bing.com/developers/appids.aspx
$searchurl .= ‘&Query=’.urlencode($termstring);
$searchurl .= ‘&Sources=Web’;
$searchurl .= ‘&Web.Count=10′; //jumlah list situs yang dihasilkan
$searchurl .= ‘&Web.Offset=0′;
$searchurl .= ‘&Web.Options=DisableHostCollapsing+DisableQueryAlterations’;
$searchurl .= ‘&JsonType=raw’;
$response = pete_curl_get($searchurl, array());
$responseobject = json_decode($response, true);if ($responseobject['SearchResponse']['Web']['Total']==0)return array();
$allresponseresults = $responseobject['SearchResponse']['Web']['Results'];
$result = array();
foreach ($allresponseresults as $responseresult){$result[] = array(‘url’ => $responseresult['Url'],’title’ => $responseresult['Title'],’abstract’ => $responseresult['Description'],);
}return $result;
}
function perform_google_web_search($termstring)
{
$start = 0;
$result = array();
while ($start<10) //kamu bisa ganti angka “10″ untuk jumlah list yang ditampilkan
{
$searchurl = ‘http://ajax.googleapis.com/ajax/services/search/web?v=1.0′;
$searchurl .= ‘&key=’.'ABCDEFG’; //ganti ABCDEFG dengan kode api Google http://code.google.com/apis/ajaxsearch/signup.html
$searchurl .= ‘&start=’.$start;
$searchurl .= ‘&rsz=large’; //kamu bisa pake “small” untuk menampilkan hanya 4 (maksimal) pencarian
$searchurl .= ‘&filter=0′; //kamu bisa ganti “filter=1″ untuk mem-filter hasil pencarian
$searchurl .= ‘&q=’.urlencode($termstring);
$response = pete_curl_get($searchurl, array());
$responseobject = json_decode($response, true);
if (count($responseobject['responseData']['results'])==0)
break;
$allresponseresults = $responseobject['responseData']['results'];
foreach ($allresponseresults as $responseresult)
{
$result[] = array(
‘url’ => $responseresult['url'],
‘title’ => $responseresult['title'],
‘abstract’ => $responseresult['content'],
);
}
$start += 8;
}
return $result;
}
function perform_boss_web_search($termstring)
{
$searchurl = ‘http://boss.yahooapis.com/ysearch/web/v1/’;
$searchurl .= urlencode($termstring);
$searchparams = array(
‘appid’ => ‘ABCDEFG’, //ganti ABCDEFG dengan kode api Yahoo Boss https://developer.apps.yahoo.com/projects/projects
‘format’ => ‘json’,
‘count’ => ’10′,
);
$response = pete_curl_get($searchurl, $searchparams);
$responseobject = json_decode($response, true);
error_log(print_r($responseobject, true));
if ($responseobject['ysearchresponse']['totalhits']==0)
return array();
$allresponseresults = $responseobject['ysearchresponse']['resultset_web'];
$result = array();
foreach ($allresponseresults as $responseresult)
{
$result[] = array(
‘url’ => $responseresult['url'],
‘title’ => $responseresult['title'],
‘abstract’ => $responseresult['abstract'],
);
}
return $result;
}if (isset($_REQUEST['s'])) {
$termstring = urldecode($_REQUEST['s']);
} else {
$termstring = ”;}
?>
Cara mendapatkan API search engine
Untuk mendapatkan API kamu harus register terlebih dahulu.
  • Yahoo Search API http://developer.yahoo.com/wsregapp/
  • Bing Search API http://www.bing.com/developers/createapp.aspx
  • Google Search API http://code.google.com/apis/ajaxsearch/signup.html
Jika sudah selesai register, kamu akan diberikan kode API, masukkan kode API ditempatnya masing-masing.
Kode 2 (hasil yang ditampilkan) Tempatkan kode berikut sebelum kode .
function CleanFileNameBan($result){
$bannedkey = array(“key”,”key”,”key”); //masukkan kata kunci satu persatu untuk menghindari kata-kata yang tidak diinginkan.
$result = str_replace($bannedkey, ”,$result);
$result = trim($result);
return $result;
}
function hilangkan_spesial_karakter($result) { //fungsi hilangkan semua spesial karakter
$result = strip_tags($result);
$result = preg_replace(‘/&.+?;/’, ”, $result);
$result = preg_replace(‘/s+/’, ‘ ‘, $result);
$result = preg_replace(‘|%([a-fA-F0-9][a-fA-F0-9])|’, ‘ ‘, $result);
$result = preg_replace(‘|-+|’, ‘ ‘, $result);
$result = preg_replace(‘/&#?[a-z0-9]+;/i’,”,$result);
$result = preg_replace(‘/[^%A-Za-z0-9 _-]/’, ‘ ‘, $result);
$result = trim($result, ‘ ‘);
return $result;
}
?>

$bingresults = perform_bing_web_search($termstring);
$bossresults = perform_boss_web_search($termstring);
$googleresults = perform_google_web_search($termstring);
//Kamu bisa ganti kode

serta test yang ada sesuai dengan kode html dan text keinginan kamu begitu juga dengan yang lainnya
print ‘

Search Result Bing:

’;
foreach ($bingresults as $result) {
print ‘
’;
print ‘

’.CleanFileNameBan(hilangkan_spesial_karakter($result['title'])).’

’;
print ‘’.CleanFileNameBan(strip_tags($result['abstract'])).’
’;
print ‘Sumber: ‘.$result['url'].’
’;
print ‘
’;
}
print ‘

Search Result Yahoo:

’;
foreach ($bossresults as $result) {
print ‘
’;
print ‘

’.CleanFileNameBan(hilangkan_spesial_karakter($result['title'])).’

’;
print ‘’.CleanFileNameBan(strip_tags($result['abstract'])).’
’;
print ‘Sumber: ‘.$result['url'].’
’;
print ‘
’;
}
print ‘

Search Result Google:

’;
foreach ($googleresults as $result) {
print ‘
’;
print ‘

’.CleanFileNameBan(hilangkan_spesial_karakter($result['title'])).’

’;
print ‘’.CleanFileNameBan(strip_tags($result['abstract'])).’
’;
print ‘Sumber: ‘.$result['url'].’
’;
print ‘
’;
}
}
?>
Selesai . . . selamat mencoba, mudah-mudahan dengan artikel Cara Bikin Auto Generate Content di Halaman Search WordPress, blog AGC nya sukses . . .

No comments:

Post a Comment