Easy Way to Make Page Auto Generated Content (AGC)

Have you ever heard the AGC (Auto Generate Content) and how you feel after getting into a blog / web AGC ..?
Example

Ok. I will try to write an article about AGC on platforms like wordpress where I set it up. Like this ..

Step 1.
Search API Bing get here earlier http://www.bing.com/developers/createapp.aspx (do not need a tutorial to get the fire from the bing? I know you know)

Step 2.
Open your editor and delete the search.php template code <?php get_header();?> , Then replace with the following code below:

<?php
if($_GET['s']!=''){
$urlredirect = get_settings('home') . '/search/' . str_replace(' ', '-' ,$_GET['s']). '.html';
header("HTTP/1.1 301 Moved Permanently");
header( "Location: $urlredirect" );
}
?>
<?php
define('BING_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, 'Mailana (curl)');
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
function perform_bing_web_search($termstring)
{
$searchurl = 'http://api.bing.net/json.aspx?';
$searchurl .= 'AppId='.'replace with your API code from bing';
$searchurl .= '&Query='.urlencode($termstring);
$searchurl .= '&Sources=Web';
$searchurl .= '&Web.Count=10';
$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;
}
if (isset($_REQUEST['s'])) {
$termstring = urldecode($_REQUEST['s']);
} else {
$termstring = '';
}
get_header(); ?>
Then look for the code <? php endif;?> and put this code on it
<?php
// If this is a search
if (is_search()) {
$s = str_replace('-', ' ', $s);
echo '<h2>';
echo 'Search Result for: <a href="'.$result['permalink'].'">'.$s.'</a>';
echo '</h2>';
// If this is a category archive
}
?>
<?php
function CleanFileNameBan($result){
$bannedkey = array("porn","adult","sex"); //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 pada Title
$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) { //fungsi ubah spasi jadi minus pada permalink title
$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 ($termstring!='') {
$bingresults = perform_bing_web_search($termstring);
foreach ($bingresults as $result) {
print '<div><h2><a href="'. get_settings('home').'/search/'.ubah_tanda(CleanFileNameBan(hilangkan_spesial_karakter
($result['title']))).'.html">'.CleanFileNameBan(hilangkan_spesial_karakter($result['title'])).'</a></h2>';
print '<p>'.$result['abstract'].'</p>';
print '<p>'.$result['url'].'</p></div>';
}
}
?>

Save and test . Hopefully this brings progress tutor for you.

Nb: Any risk of what will happen next is your responsibility and must be prepared mentally.

For the sample u can see this web: jevuska.com

0 comments

Leave a Reply

Copyright 2011 mirror News All rights reserved Designed by SimplexDesign