Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 22nd, 2010 | Syntax: PHP | Size: 3.73 KB | Hits: 242 | Expires: Never
Copy text to clipboard
  1. <?php
  2. function token($content){
  3.      preg_match('/<input type="hidden" id="_token" name="_token" value="(.*?)" \/>/', $content, $w);
  4.      return $w[1];
  5. }
  6. $hand = curl_init();
  7.  
  8. //POBIERANIE TOKENA
  9. curl_setopt($hand, CURLOPT_URL, 'http://www.erepublik.com/pl/referrer/kavillock');
  10. curl_setopt($hand, CURLOPT_RETURNTRANSFER, 1);
  11. curl_setopt($hand, CURLPROXY_HTTP, '122.224.33.10:80');
  12. curl_setopt($hand, CURLOPT_COOKIESESSION, true);
  13. curl_setopt($hand, CURLOPT_COOKIEFILE, dirname(__FILE__)."/tmp/cookiefile.txt");
  14. curl_setopt($hand, CURLOPT_COOKIEJAR, dirname(__FILE__)."/tmp/cookiefile.txt");
  15. $p=curl_exec($hand);
  16. $token = token($p);
  17.  
  18. if ($_POST['submit'] != 'submit'){
  19.         //WPROWADZENIE DANYCH DO REJESTRACJI
  20.         curl_setopt($hand, CURLOPT_URL, 'http://www.erepublik.com/pl/referrer/kavillock');
  21.         curl_setopt($hand, CURLOPT_RETURNTRANSFER, 1);
  22.         curl_setopt($hand, CURLPROXY_HTTP, '122.224.33.10:80');
  23.         curl_setopt($hand, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.1)");
  24.         curl_setopt($hand, CURLOPT_POST, 1);
  25.         curl_setopt($hand, CURLOPT_REFERER, 'http://www.erepublik.com/pl/referrer/kavillock');
  26.         $ok = urlencode('Zostañ obywatelem');
  27.         curl_setopt($hand, CURLOPT_POSTFIELDS, array(
  28.                 '_token' => $token,
  29.                 'citizen_name' => 'kavulilo',
  30.                 'citizen_password' => 'adsakura',
  31.                 'citizen_password2' => 'adsakura',
  32.                 'country_list' => 35,
  33.                 'region_list' => 426,
  34.                 'region_selected_id' => '',
  35.                 'nationality_list' => 192,
  36.                 'citizen_email' => 'a978026@owlpic.com',
  37.                 'birth_date[]' => Array
  38.                 (
  39.                         0 => 21,
  40.                         1 => 6,
  41.                         2 => 1992
  42.                 ),
  43.                 'gender' => 'M',
  44.                 'commit' => $ok,
  45.                 'agree' => 1,
  46.                 'newsletter' => 1
  47.         ));
  48.         $p=curl_exec($hand);
  49.         echo '<textarea rows="10" cols="150">'.$p.'</textarea><br>';
  50.  
  51.         //WYSWIETLANIE FORMULARZA
  52.         curl_setopt($hand, CURLOPT_URL, 'http://api.recaptcha.net/noscript?k=6LfEGgIAAAAAABSqQ0rzMd3t-rOU_XrZlC2C9WG2');
  53.         curl_setopt($hand, CURLOPT_RETURNTRANSFER, 1);
  54.         curl_setopt($hand, CURLPROXY_HTTP, '122.224.33.10:80');
  55.         $p=curl_exec($hand);
  56.         preg_match('/<input type="hidden" name="recaptcha_challenge_field" id="recaptcha_challenge_field" value="(.*?)" \/>/',$p,$dana);
  57.         $obraz = 'http://api.recaptcha.net/image?c='.$dana[1];
  58.         echo '<img src="'.$obraz.'" />';
  59.         echo'<form method="POST"><input name="id"><input type="hidden" value="'.$dana[1].'" name="dana"><input type="submit" name="submit" value="submit"></form>';
  60. }else{
  61.         //WYSY£ANIE DANYCH DO RECAPTCHA
  62.         $sub = urlencode('I\'m a Human');
  63.         curl_setopt($hand, CURLOPT_URL, 'http://api.recaptcha.net/noscript?k=6LfEGgIAAAAAABSqQ0rzMd3t-rOU_XrZlC2C9WG2');
  64.         curl_setopt($hand, CURLOPT_RETURNTRANSFER, 1);
  65.         curl_setopt($hand, CURLPROXY_HTTP, '122.224.33.10:80');
  66.         curl_setopt($hand, CURLOPT_POST, 1);
  67.         curl_setopt($hand, CURLOPT_POSTFIELDS, array(
  68.                 'recaptcha_challenge_field' => $_POST['dana'],
  69.                 'recaptcha_response_field' => $_POST['id'],
  70.                 'submit' => $sub
  71.         ));
  72.         $p=curl_exec($hand);
  73.         preg_match('/<textarea rows="3" cols="40">(.*?)<\/textarea>/s',$p,$kod);
  74.         //WYSY£ANIE DANYCH CAPTCHA
  75.         curl_setopt($hand, CURLOPT_URL, 'http://www.erepublik.com/pl/register_captcha');
  76.         curl_setopt($hand, CURLOPT_RETURNTRANSFER, 1);
  77.         curl_setopt($hand, CURLPROXY_HTTP, '122.224.33.10:80');
  78.         curl_setopt($hand, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.1)");
  79.         curl_setopt($hand, CURLOPT_POST, 1);
  80.         curl_setopt($hand, CURLOPT_HEADER, true);
  81.         curl_setopt($hand, CURLOPT_REFERER, 'http://www.erepublik.com/pl/referrer/kavillock');
  82.         curl_setopt($hand, CURLOPT_POSTFIELDS, array(
  83.                 '_token' => $token,
  84.                 'recaptcha_challenge_field' => $kod[1],
  85.                 'recaptcha_response_field' => 'manual_challenge',
  86.                 'commit' => $ok
  87.         ));
  88.         $p=curl_exec($hand);
  89.         echo '<textarea rows="10" cols="150">'.$p.'</textarea><br>';
  90.         curl_close($hand);
  91. }
  92. ?>