<?php
if($_GET['s']!=''){
$ganti = array('+',' '); //tanda plus dan spasi
$urlredirect = get_settings('home') . '/' . str_replace($ganti, '-' ,$_GET['s']). '-article.html'; //tanda plus dan spasi jadi minus
header("HTTP/1.1 301 Moved Permanently");
header( "Location: $urlredirect" );
}
?>
<?php 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_google_web_search($termstring)
{
$start = 0;
$result = array();
while ($start<5) //kamu bisa ganti angka "10" untuk jumlah list yang ditampilkan
{
$searchurl = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0';
$searchurl .= '&key='.'ABQIAAAAKHi7CRHORBZmuAkRj3jQhRSHFCN7bMxnfiBl2YDuX20znFlQ7hRgpedngSvSWh_FPTu0PWx4OXqLEQ'; //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=1'; //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'],
'thumbnail' => $responseresult['tbUrl'],
'abstract' => $responseresult['content'],
);
}
$start += 8;
}
return $result;
}
if (isset($_REQUEST['s'])) {
$termstring = urldecode($_REQUEST['s']);
} else {
$termstring = '';}
?>
Menampilkan hasil:
<!-- START AGC content -->
<?php
function CleanFileNameBan($result){
$bannedkey = array("xxx","porn","livejasmin","lesbian","sex","ngentut"); //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) {
$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;
}
function ubah_tanda($result) {
$result = strtolower($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;
}
?>
<?php $termstring = $s ?>
<?php if ($s!='') {
$googleresults = perform_google_web_search($termstring);
//Kamu bisa ganti kode <h1> serta test yang ada sesuai dengan kode html dan text keinginan kamu begitu juga dengan yang lainnya
foreach ($googleresults as $result) {
print '';
print ''.CleanFileNameBan(hilangkan_spesial_karakter($result['title'])).' ';
print ''.CleanFileNameBan(hilangkan_spesial_karakter($result['title'])).', '.CleanFileNameBan(strip_tags($result['abstract'])).'';
print '';
}
}
?>
<!-- //end AGC content -->
if($_GET['s']!=''){
$ganti = array('+',' '); //tanda plus dan spasi
$urlredirect = get_settings('home') . '/' . str_replace($ganti, '-' ,$_GET['s']). '-article.html'; //tanda plus dan spasi jadi minus
header("HTTP/1.1 301 Moved Permanently");
header( "Location: $urlredirect" );
}
?>
<?php 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_google_web_search($termstring)
{
$start = 0;
$result = array();
while ($start<5) //kamu bisa ganti angka "10" untuk jumlah list yang ditampilkan
{
$searchurl = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0';
$searchurl .= '&key='.'ABQIAAAAKHi7CRHORBZmuAkRj3jQhRSHFCN7bMxnfiBl2YDuX20znFlQ7hRgpedngSvSWh_FPTu0PWx4OXqLEQ'; //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=1'; //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'],
'thumbnail' => $responseresult['tbUrl'],
'abstract' => $responseresult['content'],
);
}
$start += 8;
}
return $result;
}
if (isset($_REQUEST['s'])) {
$termstring = urldecode($_REQUEST['s']);
} else {
$termstring = '';}
?>
Menampilkan hasil:
<!-- START AGC content -->
<?php
function CleanFileNameBan($result){
$bannedkey = array("xxx","porn","livejasmin","lesbian","sex","ngentut"); //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) {
$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;
}
function ubah_tanda($result) {
$result = strtolower($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;
}
?>
<?php $termstring = $s ?>
<?php if ($s!='') {
$googleresults = perform_google_web_search($termstring);
//Kamu bisa ganti kode <h1> serta test yang ada sesuai dengan kode html dan text keinginan kamu begitu juga dengan yang lainnya
foreach ($googleresults as $result) {
print '';
print ''.CleanFileNameBan(hilangkan_spesial_karakter($result['title'])).' ';
print ''.CleanFileNameBan(hilangkan_spesial_karakter($result['title'])).', '.CleanFileNameBan(strip_tags($result['abstract'])).'';
print '';
}
}
?>
<!-- //end AGC content -->
Komentar
Posting Komentar
SILAHKAN BERI KOMENTAR PADA POSTINGAN INI, NOTE! DI FORM KOMENTAR BILA MENGANDUNG LINK AKAN TERDETEKSI SPAM SEHINGGA KOMENTAR ANDA AKAN OTOMATIS SEGERA TERHAPUS