Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $username = "yourusername";
- $password = "yourpassword";
- $url = "https://mediocre.com/account/signin?client_id=meh.com&returnurl=https%3A%2F%2Fmeh.com%2F";
- $cookie= "cookies.txt";
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
- curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- $response = curl_exec($ch);
- if (curl_errno($ch)) die(curl_error($ch));
- $dom = new DomDocument();
- $dom->loadHTML($response);
- $tokens = $dom->getElementsByTagName("input");
- for ($i = 0; $i < $tokens->length; $i++)
- {
- $meta = $tokens->item($i);
- if($meta->getAttribute('name') == '_csrf')
- $token = $meta->getAttribute('value');
- }
- $postinfo = "user=".$username."&password=".$password."&_csrf=".$token;
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
- curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $postinfo);
- $html = curl_exec($ch);
- if (curl_errno($ch)) print curl_error($ch);
- $dom = new DomDocument();
- $dom->loadHTML($html);
- $tokens = $dom->getElementsByTagName("input");
- for ($i = 0; $i < $tokens->length; $i++)
- {
- $meta = $tokens->item($i);
- if($meta->getAttribute('name') == '_csrf') {
- $csrf = $meta->getAttribute('value');
- }
- }
- $tokens = $dom->getElementsByTagName("form");
- for ($i = 0; $i < $tokens->length; $i++)
- {
- $meta = $tokens->item($i);
- if($meta->getAttribute('method') == 'post') {
- $token = $meta->getAttribute('action');
- if (strpos($token,'deals') !== false) {
- curl_setopt($ch, CURLOPT_URL, 'https://meh.com' . $token);
- $postinfo = "_csrf=".$csrf;
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
- curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $postinfo);
- $html = curl_exec($ch);
- }
- }
- }
- curl_close($ch);
- unlink($cookie);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement