Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.06 KB | None | 0 0
  1. require "../class/simple_html_dom.php";
  2.  
  3.     $USERNAME = 'iamtherealginger13@gmail.com';
  4.     $PASSWORD = '******';
  5.     $COOKIEJAR = 'cookies.txt';
  6.  
  7.     $ch = curl_init();
  8.     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
  9.     curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
  10.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  11.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  12.     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  13.     curl_setopt($ch, CURLOPT_COOKIEJAR, $COOKIEJAR);
  14.     curl_setopt($ch, CURLOPT_COOKIEFILE, $COOKIEJAR);
  15.     curl_setopt($ch, CURLOPT_HEADER, 0);
  16.     curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  17.     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
  18.     curl_setopt($ch, CURLOPT_TIMEOUT, 120);
  19.  
  20.     curl_setopt($ch, CURLOPT_URL,
  21.                 'https://accounts.google.com/ServiceLogin?hl=en&service=alerts&continue=http://www.google.com/alerts/manage');
  22.     $data = curl_exec($ch);
  23.     $formFields = getFormFields($data);
  24.  
  25.     $formFields['Email']  = $USERNAME;
  26.     $formFields['Passwd'] = $PASSWORD;
  27.     unset($formFields['PersistentCookie']);
  28.  
  29.     $post_string = '';
  30.     foreach($formFields as $key => $value) {
  31.       $post_string .= $key . '=' . urlencode($value) . '&';
  32.     }
  33.  
  34.     $post_string = substr($post_string, 0, -1);
  35.     curl_setopt($ch, CURLOPT_URL, 'https://accounts.google.com/ServiceLoginAuth');
  36.     curl_setopt($ch, CURLOPT_POST, 1);
  37.     curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
  38.  
  39.     $result = curl_exec($ch);
  40.  
  41.     curl_setopt($ch, CURLOPT_URL, "https://accounts.google.com/o/oauth2/auth?response_type=code&scope=https://gdata.youtube.com&access_type=offline&redirect_uri=urn:ietf:wg:oauth:2.0:oob&pageId=none&client_id=911313852664-tir6o945mdn2bouorh\
  42.        palkecrg23dng9.apps.googleusercontent.com&hl=fr&from_login=1&as=-5df191bb4410a26d&pli=1&authuser=0");
  43.     curl_setopt($ch, CURLOPT_POST, 0);
  44.     curl_setopt($ch, CURLOPT_POSTFIELDS, null);
  45.  
  46.     $result = curl_exec($ch);
  47.     echo $result;
  48.     // AFFICHE LA PAGE AVEC LE BOUTON ACCEPTER
  49.     $formFields = getFormFieldsAccess($result);
  50.     $formFields["bgresponse"] = "js_disabled";
  51.     $formFields["submit_access"] = "true";
  52.     $post_string = '';
  53.     foreach($formFields as $key => $value) {
  54.       $post_string .= $key . '=' . $value . '&';
  55.     }
  56.     $post_string = substr($post_string, 0, -1);
  57.     echo 'Donneees post : ';
  58.  
  59.     preg_match_all('!https://accounts[\S]+!', $result, $matches);
  60.     $all_urls = $matches[0][2];
  61.     $all_urls = urldecode(substr($all_urls, 0, -1));
  62.     var_dump($all_urls);
  63.  
  64.     curl_setopt($ch, CURLOPT_URL, $all_urls);
  65.     curl_setopt($ch, CURLOPT_POST, 1);
  66.     curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
  67.     curl_setopt($ch, CURLOPT_REFERER, 'https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/youtube.upload&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&client_id=911313852664-tir6o945mdn2bouorhpalkecr\
  68.    g23dng9.apps.googleusercontent.com&access_type=offline&pageId=none');
  69.     $result = curl_exec($ch);
  70.     echo $result;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement