انا شحال هادي و انا خدام بهاد الكود
نتمنى اخدم ليك
كود PHP:
<?php
if ((isset($_GET['tvfun'])) && $_GET['tvfun']!='')
{
$q=strip_tags($_GET['tvfun']);
echo google_wheel($q);
}
else
{
echo 'Veuillez saisir un mot-clé !';
}
function google_wheel($q) {
$q=urlencode($q);
$search_url="http://www.google.co.ma/search?q=$q&hl=fr&tbo=1&tbs=ww:1";
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, 'Opera/9.63 (Windows NT 5.1; U; fr) Presto/2.1.1');
curl_setopt($ch, CURLOPT_URL,$search_url);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_REFERER, $search_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
$res= curl_exec($ch);
curl_close($ch);
if ($res) {
if (preg_match('/"r":\[(.*?)\]}\)/',$res,$matches))
{
$response=str_replace('"','',$matches[1]);
$response2=explode(',',$response);
$response3='';
foreach ($response2 as $key => $value)
{
$value2=urlencode($value);
$search_url2="http://www.google.co.ma/search?q=$value2&hl=fr&tbo=1&tbs=ww:1";
$ch2 = curl_init();
curl_setopt($ch2, CURLOPT_USERAGENT, 'Opera/9.63 (Windows NT 5.1; U; fr) Presto/2.1.1');
curl_setopt($ch2, CURLOPT_URL,$search_url2);
curl_setopt($ch2, CURLOPT_FAILONERROR, true);
curl_setopt($ch2, CURLOPT_REFERER, $search_url2);
curl_setopt($ch2, CURLOPT_RETURNTRANSFER,true);
$res2= curl_exec($ch2);
curl_close($ch2);
if ($res2)
{
if (preg_match('/"r":\[(.*?)\]}\)/',$res2,$matches2))
{
$response.=','.str_replace('"','',$matches2[1]);
}
}
}
$response3=array_unique(explode(',',$response));
asort($response3);
$res_final='Tag : '.urldecode($q);
$res_final.='<br />(';
foreach ($response3 as $key => $value)
{
$res_final.='<a href="http://www.tvfun.ma/'.str_replace(" ","-",utf8_decode($value)).'/">'.utf8_decode($value).'</a>, ';
//flush();
}
$res_final.=')';
}
}
return $res_final;
}
?>