Цитата:
Сообщение от it.netov
mrWEB, какой провайдер? Скрипт сразу post запрос шлёт или имитирует заход на страницу с формой предварительно? Куки каждый раз чистятся?
|
Провайдер мегафон )
Етот скрипт http://myseoincome.ru/wp-content/upl.../02/yandex.rar я только его через хуман емулятор юзаю:
// The following code is required to properly run Xedant.com Human Emulator
require("../../Templates/xedant_human_emulator.php");
set_time_limit(0);
//ключь anti-captcha
$anti_captcha_key = 'ключ';
//файлик с URLами
$urls = file('../../url/url.txt');
$i=1;
foreach ($urls as $link){ //получили адрес
$data = geturl('http://webmaster.yandex.ru/');
$key = cut_str($data, 'name="key" value="','"'); //получили идентификатор сеанса
$captcha = geturl('http://captcha.yandex.net/image?key='.$key); //слили капчу
$postdata = array(
'method' => 'base64',
'key' => $anti_captcha_key,
'body' => base64_encode($captcha),
'ext' => 'jpg',
'phrase' => 0,
'regsense' => 0,
'numeric' => 0,
'min_len' => 0,
'max_len' => 0
);
$rev = geturl("http://anti-captcha.com/in.php",$postdata); //отдали капчу антикапче
if (substr($rev,0,2)=='OK'){
$anti_captcha_id = substr($rev,3);
}else{
echo "Upload ERROR";
exit;
}
sleep(20); //подождем 20сек. пока ее разгадают
$postdata = array(
'key' => $anti_captcha_key,
'action' => 'get',
'id' => $anti_captcha_id
);
$cap = geturl("http://anti-captcha.com/res.php",$postdata); //ответ от антикапчи
if (substr($cap,0,2)=='OK'){
$captcha_value = substr($cap,3);
}else{
echo $cap;
exit;
}
$postdata = array(
'url' => $link,
'key' => $key,
'rep' => $captcha_value
);
$cap = geturl("http://webmaster.yandex.ru/add.xml",$postdata); //спамим в яндекс
echo $i.": ".$link.' - ';
if (strpos($cap, 'успешно добавлен')){
echo 'ok
';
}elseif (strpos($cap, 'уже проиндексирован')){
echo 'в индексе
';
}elseif (strpos($cap, 'является зеркалом')){
echo 'зеркало
';
}elseif (strpos($cap, 'неверно указали цифровой код')){
echo 'Captcha error
';
$postdata = array(
'key' => $anti_captcha_key,
'action' => 'reportbad',
'id' => $anti_captcha_id
);
$cap = geturl("http://anti-captcha.com/res.php",$postdata);
}elseif (strpos($cap, 'robots.txt')){
echo 'запрещен в файле robots.txt
';
}elseif (strpos($cap, 'отличный от 200')){
echo '404
';
}elseif (strpos($cap, 'запрещен к индексированию')){
echo 'ban
';
}else{
echo 'error
';
echo $cap;
exit;
}
$i++;
}
//возвращает то, что между $left и $right в $str
function cut_str($str, $left, $right)
{
$str = substr(stristr($str, $left), strlen($left));
$leftLen = strlen(stristr($str, $right));
$leftLen = $leftLen ? -($leftLen) : strlen($str);
$str = substr($str, 0, $leftLen);
return $str;
}
function geturl($url,$postdata=0)
{
$poststr="";
if ($postdata)
while (list($name,$value)=each($postdata)){
if (strlen($poststr)>0)
$poststr.="&";
$poststr.=$name."=".urlencode($value);
}
// инициализация сеанса
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
if ($postdata){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $poststr);
}
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);
curl_close($ch);
return $res;
}
// Quit
$app->quit();
?>