@ 2013-09-10T07:31:20Z <?php
chdir("/home/kolhozba/public_html/obmen/");
function action($nextUrl)
{
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, $nextUrl);
curl_setopt ($curl, CURLOPT_AUTOREFERER, true); // TRUE для автоматической установки поля Referer: в запросах, перенаправленных заголовком Location:.
curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, true); // TRUE для следования любому заголовку "Location: ", отправленному сервером в своем ответе (учтите, что это происходит рекурсивно, PHP будет следовать за всеми посылаемыми заголовками "Location: ", за исключением случая, когда установлена константа CURLOPT_MAXREDIRS).
curl_setopt ($curl, CURLOPT_TIMEOUT, 10); // Сколько сек. ждать ответ сервра
curl_setopt ($curl, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt ($curl, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt ($curl, CURLOPT_USERAGENT, "Opera/9.80 (J2ME/MIDP; Opera Mini/9.80 (S60; SymbOS; Opera Mobi/23.334; U; id) Presto/2.5.25 Version/10.54");
curl_setopt ($curl, CURLOPT_HEADER, true); // TRUE для включения заголовков в вывод.
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt ($curl, CURLOPT_RETURNTRANSFER, true); // TRUE для возврата результата передачи в качестве строки из curl_exec() вместо прямого вывода в браузер.
$out = curl_exec($curl);
curl_close($curl);
return $out;
}
$arr=file('list.txt');
for ($i=0;$i<count($arr);$i++)
{
$nextUrl=$arr[$i];
$hostUrl=parse_url($nextUrl);
$hostUrl=$hostUrl["host"];
sleep(mt_rand(1,4));
action($nextUrl);
$nextUrl='http://'.$hostUrl.'/converter';
sleep(mt_rand(1,4));
$dump=action($nextUrl);
$dom = new DomDocument;
@$dom->loadHTML($dump);
$xpath = new DomXPath($dom);
if ($xpath->evaluate("//div[@class='content']/div[@class='block']/div[2]/a/text()")->item(0)->nodeValue=='Обменять')
{
$xpath=$xpath->evaluate("//div[@class='content']/div[@class='block']/div[2]/a")->item(0)->getAttribute('href');
$nextUrl='http://'.$hostUrl.'/'.$xpath;
sleep(mt_rand(1,4));
$dump=action($nextUrl);
$dom = new DomDocument;
@$dom->loadHTML($dump);
$xpath = new DomXPath($dom);
$xpath=$xpath->evaluate("//div[@style='text-align:center;']/div[@class='pt']/a")->item(0)->getAttribute('href');
$nextUrl='http://'.$hostUrl.'/'.substr($xpath, 6);
sleep(mt_rand(1,4));
$dump=action($nextUrl);
}
else
{
$xpath=$xpath->evaluate("//div[@style='text-align:center;']/div[@class='pt']/a")->item(0)->getAttribute('href');
$nextUrl='http://'.$hostUrl.'/'.$xpath;
sleep(mt_rand(1,4));
$dump=action($nextUrl);
}
}
echo "Done";
?>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 5.3.0 , 5.3.3 - 5.3.7 , 5.3.14 , 5.3.16 - 5.3.17 , 5.3.22 , 5.3.24 , 5.4.0 - 5.4.5 , 5.4.8 , 5.4.11 - 5.4.13 , 5.5.2 - 5.5.3 Warning: chdir(): No such file or directory (errno 2) in /in/mEe1I on line 2
Warning: file(list.txt): failed to open stream: No such file or directory in /in/mEe1I on line 20
Notice: Undefined index: host in /in/mEe1I on line 25
Process exited with code 137 . Output for 5.3.1 - 5.3.2 , 5.3.8 - 5.3.13 , 5.3.15 , 5.3.18 - 5.3.21 , 5.3.23 , 5.3.25 - 5.3.27 , 5.4.6 - 5.4.7 , 5.4.9 - 5.4.10 , 5.4.14 - 5.4.19 , 5.5.0 - 5.5.1 Warning: chdir(): No such file or directory (errno 2) in /in/mEe1I on line 2
Warning: file(list.txt): failed to open stream: No such file or directory in /in/mEe1I on line 20
Notice: Undefined index: host in /in/mEe1I on line 25
Fatal error: Call to undefined function curl_init() in /in/mEe1I on line 5
Process exited with code 255 . preferences:dark mode live preview
83.59 ms | 404 KiB | 57 Q