Jump to content
mandeamarian

Help please!

Recommended Posts

Posted

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 HELP

Codul:

<?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 lines

foreach($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!

Posted

<?php

set_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 />";
}

?>

Posted

<?php

set_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?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...