diff --git a/scripts/monitor_recherche.php b/scripts/monitor_recherche.php index 3e025b74c2aa054df53943781d77367bfb8c08c5..7713cba0ffdc96a833e90b905ed8865a2a9bc4ec 100644 --- a/scripts/monitor_recherche.php +++ b/scripts/monitor_recherche.php @@ -1,32 +1,48 @@ <?php error_reporting(E_ALL^E_DEPRECATED); -function new_recherche($expression_recherchee){ +if (!isset($argv[1])) { + echo 'I need bokeh URL !!'; + exit(1); +} + + +function new_recherche($expression_recherchee, $url){ $cookie_file = tempnam("/tmp", "cookie"); - $url_recherche = "http://opacce.pergame.net/opacce.pergame.net/recherche/simple/expressionRecherche/"; + $url_recherche = $url . '/recherche/simple/expressionRecherche/'; $curl_old_step_1 = curl_init($url_recherche.$expression_recherchee); curl_setopt($curl_old_step_1,CURLOPT_COOKIEJAR, $cookie_file); - curl_setopt($curl_old_step_1,CURLOPT_COOKIEFILE, $cookie_file); + curl_setopt($curl_old_step_1,CURLOPT_COOKIEFILE, $cookie_file); curl_setopt($curl_old_step_1,CURLOPT_RETURNTRANSFER, true); $result_old_step_1 = curl_exec($curl_old_step_1); $total_time = curl_getinfo($curl_old_step_1,CURLINFO_TOTAL_TIME ); curl_close($curl_old_step_1); - if (false == strpos($result_old_step_1, 'Recherche: '.$expression_recherchee)) { - echo "Error\n"; - } - - echo date("H:i:s")." : $total_time s\n"; + echo date("H:i:s")." : $total_time s [$expression_recherchee]\n"; return $total_time; } // main while(true) { - foreach(['sport', 'france', 'pomme', 'informatique'] as $terme) { - new_recherche($terme); + foreach(['sport', + 'france', + 'pomme', + 'informatique', + 'plaine', + 'poire', + 'histoire', + 'camille', + 'mysql', + 'ukulélé', + 'minion', + 'partition', + 'musique', + 'théatre', + 'cinéma'] as $terme) { + new_recherche($terme, $argv[1]); sleep(5); } }