Advertisement
terorama

Yandex Captcha

Sep 29th, 2012
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.12 KB | None | 0 0
  1. <?php
  2.  
  3. if (isset($_GET["rep3"])) {
  4.    send_cap();
  5. }
  6. else
  7.    load_page_alt('http://blogs.yandex.ru/search.xml?text='.rawurlencode('концерт'));
  8.  
  9. function send_cap() {
  10.  
  11.    $url='http://blogs.yandex.ru/checkcaptcha?rep='.$_GET["rep3"].
  12.            '&key='.$_GET["key3"].'&retpath='.$_GET["retpath3"];
  13.  
  14.    echo '<b>'.$url.'</b><br/>';
  15.    $ch = curl_init();
  16.    curl_setopt($ch, CURLOPT_HEADER,1);
  17.    //curl_setopt($ch, CURLOPT_POST,1)
  18.    curl_setopt($ch, CURLOPT_URL, $url);
  19.    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
  20.    curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
  21.    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)");
  22.    curl_setopt($ch, CURLOPT_COOKIEFILE, 'yacook.txt');
  23.    curl_setopt($ch, CURLOPT_COOKIEJAR, 'yacook.txt');
  24.    
  25.    curl_setopt($ch, CURLOPT_REFERER,'http://blogs.yandex.ru/showcaptcha?retpath=http%3A//blogs.yandex.ru/search.xml%3Ftext%3D%25EA%25EE%25ED%25F6%25E5%25F0%25F2&t=0/1348956701/2a68e643f520fd91f358b6789c10e8f5&status=failed&s=86568a1fe5774c0ca9745b045091e00e');
  26.  
  27.    $result = curl_exec($ch);
  28.  
  29.    $result = mb_convert_encoding($result,'windows-1251');
  30.  
  31.    echo $result;
  32. }
  33.  
  34. //-------------------------------------------------------
  35. function load_page_alt($url) {
  36.  
  37.    header('Content-type: text/html; charset=windows-1251');
  38.    
  39.    $ch = curl_init();
  40.  
  41.    curl_setopt($ch, CURLOPT_HEADER, 1);
  42.    curl_setopt($ch, CURLOPT_URL, $url);
  43.    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
  44.    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  45.    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)");
  46.  
  47.    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  48.    curl_setopt($ch, CURLOPT_COOKIEFILE, 'yacook.txt');
  49.    curl_setopt($ch, CURLOPT_COOKIEJAR, 'yacook.txt');
  50.  
  51.    $result = curl_exec($ch);
  52.    curl_close($ch);
  53.  
  54.    $ftg = mb_detect_encoding($result);
  55.    echo 'encoding:'.$ftg.'<br/>';
  56.    $result = mb_convert_encoding($result, 'windows-1251', $ftg);
  57.  
  58.    $zzuu = '"'.$_SERVER["PHP_SELF"].'"';
  59.  
  60.    $zzstr = <<<INF
  61.  
  62.    <script type="text/javascript">
  63.       function submuu(f) {
  64.         var zwin =  open ( {$zzuu}+"?rep3="+encodeURIComponent(f.rep3.value)+
  65.              "&key3="+encodeURIComponent(f.key3.value)+
  66.              "&retpath3="+encodeURIComponent(f.retpath3.value));
  67.       }
  68.  
  69.        function fff() {
  70.  
  71.          //alert('test');
  72.          var fz=document.forms[1];
  73.          var fgo = document.forms[0];
  74.          //alert(fz);
  75.  
  76.          fgo.key3.value = fz.key.value;
  77.          fgo.retpath3.value = fz.retpath.value;
  78.       }
  79.    </script>
  80.  
  81.    <form action="#" onsubmit="submuu(this);return false;" method="GET">
  82.    <input type="TEXT" name="rep3" />
  83.    <p> key <input type="TEXT" name="key3"  /></p>
  84.    <p> retpath <input type="TEXT" name="retpath3" /></p>
  85.    
  86.    <input type="SUBMIT" name="subm3" value="send" />
  87.    <input type="BUTTON" onclick="fff();" value="fill" />
  88.    </form>
  89.  
  90. INF;
  91.    echo $zzstr;
  92.    
  93.    //$result = mb_convert_encoding($result,'windows-1251');
  94.    echo $result;
  95.  
  96.    //echo '<pre>'.htmlentities(print_r($result)).'</pre>';
  97.  
  98.    
  99.    
  100. }
  101.  
  102. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement