par
Le paysan » 28 janv. 2015, 16:51
Bonjour,
Voici mon code :
$tabUrls = "https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=" . $keywords . "&start=8&rsz=8&hl=fr";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $tabUrls); // Fais la recherche
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, $tabUrls); //=======>>>> Le probleme vient de ces 5 lignes, qui ne renvoient jamais la meme chose ! <<<<<<<=======
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$body = curl_exec($ch);
curl_close($ch);
$html = json_decode($body);
Il est sensé rechercher le keywords dans Google et me le retourner.
Sauf que ben des fois il le trouve, et des fois non, ça me rend fou. Il n'y a aucune répétition, logique lorsque j'effectue la tache en masse.
Cordialement
Bonjour,
Voici mon code :
[php]$tabUrls = "https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=" . $keywords . "&start=8&rsz=8&hl=fr";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $tabUrls); // Fais la recherche
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, $tabUrls); //=======>>>> Le probleme vient de ces 5 lignes, qui ne renvoient jamais la meme chose ! <<<<<<<=======
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$body = curl_exec($ch);
curl_close($ch);
$html = json_decode($body);[/php]
Il est sensé rechercher le keywords dans Google et me le retourner.
Sauf que ben des fois il le trouve, et des fois non, ça me rend fou. Il n'y a aucune répétition, logique lorsque j'effectue la tache en masse.
Cordialement