залогиниться, пишет типа "Your browser is not sending the correct data." -
браузер не правильно передает данные, но вроде все передаю, вот код.
Посмотрите, в друг что-то забыл или не дописал.
//MyCurl.class.php
/**
* MyCurl - класс для работы с курлом
*
* @author WINROL
* @copyright 2013
* @version $Id$
* @access public
*/
class MyCurl{
public $host = NULL;
public $clearHeader = true;
public $cookie;
public $isAjax = false;
public $isUserCookie=false;
public $proxy = false;
public $agent = false;
public function __construct($host){
$this->host = $host;
}
public function getContent($link,$refer='',$post=''){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$this->host.$link);
//ajax
if(!($this->isAjax)){
$headers = array(
"Accept: text/html, application/xml;q=0.9, application/xhtml+xml,
image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1",
"Accept-Language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3",
"Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7"
);
}else{
$headers = array("X-Requested-With: XMLHttpRequest",
"Content-Type: application/x-www-form-urlencoded; charset=UTF-8",
"Accept: text/html, */*; q=0.01",
"Accept-Language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3",
"Connection: keep-alive"
);
$this->isAjax=false;
}
# добавляем заголовков к нашему запросу. Чтоб смахивало на настоящих гг
//curl_setopt($ch, CURLOPT_HTTPHEADER, array('Transfer-Encoding: ','Expect:'));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
if($this->agent)
curl_setopt($ch, CURLOPT_USERAGENT, $this->agent);
else
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U;
Windows NT 6.1; ru-RU) AppleWebKit/534.16 (KHTML, like Gecko)
Chrome/10.0.648.11 Safari/534.16');
curl_setopt($ch, CURLOPT_HEADER,false);
curl_setopt($ch, CURLOPT_FAILONERROR,true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 80);
curl_setopt($ch, CURLOPT_COOKIEJAR,dirname(__FILE__).'/cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE,dirname(__FILE__).'/cookie.txt');
//curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
// curl_setopt($ch, CURLOPT_ENCODING,'');
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_TIMEOUT, 80);
//location
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_POST, true);
}
if(!empty($refer)){
curl_setopt($ch, CURLOPT_REFERER, $refer);
}
if($this->proxy){
curl_setopt($ch, CURLOPT_PROXY, $this->proxy);
}
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
$out = curl_exec($ch);
curl_close($ch);
return $out;
}
}
Сам код
session_start();
set_time_limit(0);
if(file_exists('cookie.txt'))
unlink('cookie.txt');
function myRelace($content){
//<script src="https://fullcache-neodevlda.netdna-ssl.com/js/principal22.js" type="text/javascript"></script>
//
$content = preg_replace('/\s*(src\=\"https?\:\/\/fullcache\-neodevlda\.netdna\-ssl\.com\/js\/principal22\.js\")\stype/iU',
'',$content);
return $content;
}
header('Content-type: text/html; charset=utf-8');
error_reporting(E_ALL ^E_NOTICE);
require_once('MyCurl.class.php');
$host = 'https://www.neobux.com';
$proxy = new MyCurl($host);
//пытаемся войти
$proxy->host = 'https://www.neobux.com';
$content = $proxy->getContent('/m/l/','http://www.neobux.com/');
file_put_contents('login.html',myRelace($content));
echo myRelace($content);
//выдираем
//name="lge" value="65AB
preg_match('/name\=\"lge\"\svalue\=\"([\w\d]{50,1000})\"\s*/i',$content,$lge);
//name="A06A2294C5017BA5BDD87990443EC428" id="Kf1"
preg_match('/\sname\=\"([\w\d]+)\"\s*id\=\"Kf1\"/i',$content,$login);
//name="A793C4FEA59A6416E84DFA719B7CE6AD" id="Kf2"
preg_match('/\sname\=\"([\w\d]+)\"\s*id\=\"Kf2\"/i',$content,$pass1);
//name="A793C4FEA59A6416E84DFA719B7CE6AD" id="Kf4"
preg_match('/\sname\=\"([\w\d]+)\"\s*id\=\"Kf4\"/i',$content,$pass2);
//name="A793C4FEA59A6416E84DFA719B7CE6AD" id="Kf3"
preg_match('/\sname\=\"([\w\d]+)\"\s*id\=\"Kf3\"/i',$content,$e);
$post='lge='.$lge[1].'&'.$login[1].'=Winrilz&'.$pass1[1].'=Winrilz123321&'.$pass2[1].'=Winrilz123321&'.$e[1].'=&login=1';
sleep(5);
$content = $proxy->getContent('/m/l/', 'https://www.neobux.com/m/l/', $post);
file_put_contents('login2.html',myRelace($content));
echo myRelace($content);
sleep(5);
$proxy->host = 'http://www.neobux.com';
$content = $proxy->getContent('/c/');
file_put_contents('in.html',myRelace($content));
echo myRelace($content);
die('...');
_____________
Заработай легко - много видов проверенного заработка, как Wap та и Web.