Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Nulogy{
- public $u;
- public $s;
- public $url;
- public $post;
- public $resposta;
- public $cookie;
- public $token;
- public function __construct(){
- $this->u = 'usuario-aqui';
- $this->s = 'senha-aqui';
- $this->cookie = dirname(__FILE__) . '/cookie/' .'NULOGY[COOKIE]' . rand(0, 999999) . '.txt';
- }
- public function fazerLogin(){
- $this->url = 'https://packmanager.nulogy.net/sign_in';
- $this->loginPlayLoad();
- var_dump($this->resposta);
- }
- public function loginPlayLoad(){
- $this->getTokenLogin();
- if($this->token){
- $data['utf8'] = '✓';
- $data['authenticity_token'] = $this->token;
- $data['return'] = '';
- $data['uv_login'] = '';
- $data['user[login]'] = $this->u;
- $data['user[password']= $this->s;
- $data['commit'] = 'Sign in';
- $data['authenticity_token'] = $this->token;
- $data['authenticity_token'] =$this->token;
- }else{
- return false;
- }
- $this->post = http_build_query($data);
- return true;
- }
- public function getTokenLogin(){
- $this->url = 'https://packmanager.nulogy.net/sign_in';
- $this->get();
- preg_match_all('/meta content="(.*?)" name="csrf-token"/', $this->resposta, $matches, PREG_SET_ORDER, 0);
- $token = $matches[0][1];
- if($token){
- return $this->token = $token;
- }else{
- return array('status' => false,'resposta' => 'Não foi possível encontrar CSRF-TOKEN' );
- }
- }
- public function post(){
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $this->url);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $this->post);
- curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0');
- curl_setopt($ch, CURLOPT_REFERER, "https://packmanager.nulogy.net/sign_in");
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
- curl_setopt($ch, CURLOPT_MAXREDIRS, 0);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
- curl_setopt($ch, CURLOPT_TIMEOUT, 30);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_COOKIEJAR, $this->cookie);
- curl_setopt($ch, CURLOPT_COOKIEFILE, $this->cookie);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded"));
- curl_setopt($ch, CURLOPT_ENCODING, '');
- $this->resposta = curl_exec($ch);
- }
- public function get(){
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $this->url);
- curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0');
- curl_setopt($ch, CURLOPT_REFERER, "https://packmanager.nulogy.net/sign_in");
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($ch, CURLOPT_MAXREDIRS, 0);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
- curl_setopt($ch, CURLOPT_TIMEOUT, 30);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_COOKIEJAR, $this->cookie);
- curl_setopt($ch, CURLOPT_COOKIEFILE, $this->cookie);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded"));
- curl_setopt($ch, CURLOPT_ENCODING, '');
- $this->resposta = curl_exec($ch);
- }
- }
- $x = new Nulogy();
- var_dump( $x->fazerLogin());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement