/*
* Checks if there are other descriptions like the one provided
* @author Tiger (http://www.seoblackout.com)
* @author adapted by BlackMelvyn (http://www.theblackmelvyn.com)
* @param string $description description provided by the visitor
* @return bool TRUE if description exists FALSE if description is clean
*/
function checkDupe($description){
$description = str_replace('"','',$description);
$desc_cut=wordwrap(stripslashes($desc),100,"
",1);
$cut = explode('
', $desc_cut);
$cut = $cut[0] ;
$url = 'http://www.google.fr/search?hl=fr&q="'. urlencode($cut).'"&filter=0';
if (function_exists('curl_init')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$data=curl_exec ($ch);
curl_close ($ch);
}
else {
$data= file_get_contents($url);
}
$page = $data ;
$result = explode('environ ', $page);
$result1 = $result[1] ;
$result2 = explode('pour', $result1);
$result3 = $result2[0] ;
$result3 = trim(strip_tags(str_replace(' ', '', $result3)));
// If more than 5 results found, stop the process
if ($result3 > 5){
return true;
}
else {
return false;
}
}