Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $cookies = getGemoteCookies('https://freedom-stat.com/');
- echo "<pre>";
- print_r( $cookies );
- echo "</pre><hr>";
- $tmp2 = regDemo($cookies);
- echo "<pre>";
- print_r( $tmp2 );
- echo "</pre>";
- exit;
- function getGemoteCookies( $url )
- {
- $headers = array(
- 'Host: freedom-stat.com',
- 'Connection: keep-alive',
- //'Content-Length: 43',
- 'Origin: https://freedom-stat.com',
- 'User-Agent: Opera/9.80 (Windows NT 6.2; WOW64) Presto/2.12.388 Version/12.17',
- 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8',
- 'Accept: application/json, text/javascript, */*; q=0.01',
- 'X-Requested-With: XMLHttpRequest',
- 'x-fingerprint: d6004755957cd406a3f84d14d5622ebc',
- 'Save-Data: on',
- 'Sec-Fetch-Site: same-origin',
- 'Sec-Fetch-Mode: cors',
- 'Referer: https://freedom-stat.com/',
- 'Accept-Encoding: gzip, deflate, br',
- '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'
- );
- $ch = curl_init( $url );
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HEADER, 1);
- curl_setopt($ch, CURLOPT_NOBODY, 1);
- $result = curl_exec($ch);
- echo "<pre>"; print_r($result); echo "</pre>";
- preg_match_all('/^Set-Cookie:\s*([^;]*)/mi', $result, $matches);
- $cookies = array();
- foreach($matches[1] as $item) {
- parse_str($item, $cookie);
- $cookies = array_merge($cookies, $cookie);
- }
- return $cookies ;
- }
- function regDemo($cookies)
- {
- $array = array(
- 'email' => 'cevabip326@mailer9.net',// пример временной почты. сейчас должно писать "ошибка ввода данных", ибо почта уже использовалась.
- 'reg_type' => '1'
- );
- $headers = array(
- 'Host: freedom-stat.com',
- 'Connection: keep-alive',
- 'Content-Length: 43',
- 'Origin: https://freedom-stat.com',
- 'User-Agent: Opera/9.80 (Windows NT 6.2; WOW64) Presto/2.12.388 Version/12.17',
- 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8',
- 'Accept: application/json, text/javascript, */*; q=0.01',
- 'X-Requested-With: XMLHttpRequest',
- 'x-fingerprint: d6004755957cd406a3f84d14d5622ebc',
- 'Save-Data: on',
- 'Sec-Fetch-Site: same-origin',
- 'Sec-Fetch-Mode: cors',
- 'Referer: https://freedom-stat.com/',
- 'Accept-Encoding: gzip, deflate, br',
- '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',
- 'Cookie: XSRF-TOKEN='.$cookies['XSRF-TOKEN'].'%3D;laravel_session='.$cookies['laravel_session'].'%3D;'
- );
- $ch = curl_init('https://freedom-stat.com/regDemo');
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $array);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HEADER, 1);
- curl_setopt($ch, CURLOPT_COOKIE, 'XSRF-TOKEN='.$cookies['XSRF-TOKEN'].'%3D;laravel_session='.$cookies['laravel_session'].'%3D;');
- $json = curl_exec($ch);
- curl_close($ch);
- return $json;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement