Advertisement
Guest User

Untitled

a guest
Dec 28th, 2019
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.08 KB | None | 0 0
  1. <?php
  2.     $cookies = getGemoteCookies('https://freedom-stat.com/');
  3.    
  4.  
  5.     echo "<pre>";
  6.     print_r( $cookies );
  7.     echo "</pre><hr>";
  8.  
  9.     $tmp2 = regDemo($cookies);
  10.  
  11.     echo "<pre>";
  12.     print_r( $tmp2 );
  13.     echo "</pre>";
  14.  
  15. exit;
  16.  
  17. function getGemoteCookies( $url )
  18. {
  19.     $headers = array(
  20.         'Host: freedom-stat.com',
  21.         'Connection: keep-alive',
  22.         //'Content-Length: 43',
  23.         'Origin: https://freedom-stat.com',
  24.         'User-Agent: Opera/9.80 (Windows NT 6.2; WOW64) Presto/2.12.388 Version/12.17',
  25.         'Content-Type: application/x-www-form-urlencoded; charset=UTF-8',
  26.         'Accept: application/json, text/javascript, */*; q=0.01',
  27.         'X-Requested-With: XMLHttpRequest',
  28.         'x-fingerprint: d6004755957cd406a3f84d14d5622ebc',
  29.         'Save-Data: on',
  30.         'Sec-Fetch-Site: same-origin',
  31.         'Sec-Fetch-Mode: cors',
  32.         'Referer: https://freedom-stat.com/',
  33.         'Accept-Encoding: gzip, deflate, br',
  34.         'Accept-Language: uk,ru;q=0.9,en;q=0.8,be;q=0.7,bg;q=0.6,la;q=0.5,ro;q=0.4'
  35.     );
  36.  
  37.  
  38.     $ch = curl_init( $url );
  39.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  40.     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  41.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  42.     curl_setopt($ch, CURLOPT_HEADER, 1);
  43.     curl_setopt($ch, CURLOPT_NOBODY, 1);
  44.     $result = curl_exec($ch);
  45.     echo "<pre>"; print_r($result); echo "</pre>";
  46.     preg_match_all('/^Set-Cookie:\s*([^;]*)/mi', $result, $matches);
  47.     $cookies = array();
  48.     foreach($matches[1] as $item) {
  49.         parse_str($item, $cookie);
  50.         $cookies = array_merge($cookies, $cookie);
  51.     }
  52.     return $cookies ;
  53. }
  54.  
  55.  
  56. function regDemo($cookies)
  57. {
  58.     $array = array(
  59.         'email'   => 'cevabip326@mailer9.net',// пример временной почты. сейчас должно писать "ошибка ввода данных", ибо почта уже использовалась.
  60.         'reg_type' => '1'
  61.     );     
  62.     $headers = array(
  63.         'Host: freedom-stat.com',
  64.         'Connection: keep-alive',
  65.         'Content-Length: 43',
  66.         'Origin: https://freedom-stat.com',
  67.         'User-Agent: Opera/9.80 (Windows NT 6.2; WOW64) Presto/2.12.388 Version/12.17',
  68.         'Content-Type: application/x-www-form-urlencoded; charset=UTF-8',
  69.         'Accept: application/json, text/javascript, */*; q=0.01',
  70.         'X-Requested-With: XMLHttpRequest',
  71.         'x-fingerprint: d6004755957cd406a3f84d14d5622ebc',
  72.         'Save-Data: on',
  73.         'Sec-Fetch-Site: same-origin',
  74.         'Sec-Fetch-Mode: cors',
  75.         'Referer: https://freedom-stat.com/',
  76.         'Accept-Encoding: gzip, deflate, br',
  77.         'Accept-Language: uk,ru;q=0.9,en;q=0.8,be;q=0.7,bg;q=0.6,la;q=0.5,ro;q=0.4',
  78.         'Cookie: XSRF-TOKEN='.$cookies['XSRF-TOKEN'].'%3D;laravel_session='.$cookies['laravel_session'].'%3D;'
  79.     );
  80.  
  81.     $ch = curl_init('https://freedom-stat.com/regDemo');
  82.     curl_setopt($ch, CURLOPT_POST, 1);
  83.     curl_setopt($ch, CURLOPT_POSTFIELDS, $array);
  84.     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  85.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  86.     curl_setopt($ch, CURLOPT_HEADER, 1);
  87.     curl_setopt($ch, CURLOPT_COOKIE, 'XSRF-TOKEN='.$cookies['XSRF-TOKEN'].'%3D;laravel_session='.$cookies['laravel_session'].'%3D;');
  88.     $json = curl_exec($ch);
  89.     curl_close($ch);   
  90.      
  91.     return $json;
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement