mandeamarian Posted November 24, 2011 Report Posted November 24, 2011 Am un script facut din bucati de mine (habar nu am php) care ia dintr-o lista de siteuri linie cu linie , intra pe ele si cauta dupa un anumit keyword, problema e ca, indiferent daca exista sau nu cuvantul respectiv pe site el zice ca exista........si m-am blocat nu mai gasesc "scapare" )PLEASE HELPCodul:<?php// --------------$fisier = "list.txt"; // fisier cu ip-uri$data = file_get_contents($fisier); // read all data from the file$lines = explode("\n", $data); // split data into linesforeach($lines as $line) // for each line{// search module$userAgent = 'Googlebot/2.1 (http://www.googlebot.com/bot.html)';$url = "$line";$curl = curl_init($url);curl_setopt($curl, CURLOPT_USERAGENT, $userAgent);curl_setopt($curl, CURLOPT_URL, $url);curl_setopt($curl, CURLOPT_AUTOREFERER, true);curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);curl_setopt($curl, CURLOPT_TIMEOUT, true);$link1 = curl_exec($curl);$match = "caca";if (@preg_match($match, $link1));{echo "$line = found..\n";$fp = fopen('log.txt', 'a');fwrite($fp, "http://$line\n");fclose($fp);}else{echo "STRING NOT FOUND in $line\n";curl_close($curl);}}?>MULTUMESC MULT DE TOT! Quote
ROFL Posted November 24, 2011 Report Posted November 24, 2011 <?phpset_time_limit(0);$file = file("lista.txt");$keyword = "test";foreach($file as $url){ $page = file_get_contents($url); if(strstr($page, $keyword)) echo $url." - AM GASIT!<br />"; else echo $url." - N-AM GASIT!<br />";}?> Quote
mandeamarian Posted November 24, 2011 Author Report Posted November 24, 2011 <?phpset_time_limit(0);$file = file("lista.txt");$keyword = "test";foreach($file as $url){ $page = file_get_contents($url); if(strstr($page, $keyword)) echo $url." - AM GASIT!<br />"; else echo $url." - N-AM GASIT!<br />";}?>Multumescu mult, insa nu se poate face cu, curl ci nu cu file_get_contents? Quote
GarryOne Posted November 25, 2011 Report Posted November 25, 2011 se poate face, dar atata timp cat functioneaza de ce sa faca cu cURL, tinand cont ca cu cURL e mai complicat. Quote