Advertisement
Guest User

Untitled

a guest
Jan 27th, 2019
959
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.72 KB | None | 0 0
  1. <?php
  2. require __DIR__.'/vendor/autoload.php';
  3. $atom = new Atomic(['path_tmp' => __DIR__ .'/tmp']);
  4. $atom->set('rucaptcha_key', '');
  5. $tokens = array();
  6.  
  7. $baseTXT = file('logpassvkbase.txt');
  8. foreach ($baseTXT as $value) {
  9. test($value);
  10.     $logpass = explode(":", $value);
  11.  
  12. $token_fun = tokenVK($logpass[0], $logpass[1], $atom);
  13. echo $token_fun;
  14. }
  15.  
  16. function tokenVK($login, $password, $atom) {
  17. $token_url = $atom->request([
  18.     'url' => 'https://oauth.vk.com/token?grant_type=password&client_id=2274003&client_secret=hHbZxrka2uZ6jB1inYsH&username='.$login.'&password='.$password,
  19.     'no_headers' => true,
  20. ]);
  21. $token_url = json_decode($token_url);
  22. //-----------------Ввод капчи, если запросили--------------
  23. if($token_url->captcha_sid){
  24. $ch = curl_init($result->captcha_img);
  25. $fp = fopen('captcha.png', 'wb');
  26. curl_setopt($ch, CURLOPT_FILE, $fp);
  27. curl_setopt($ch, CURLOPT_HEADER, 0);
  28. curl_exec($ch);
  29. curl_close($ch);
  30. fclose($fp);
  31. $imgcap = 'captcha.png';
  32.         try {
  33.     $code = $atom->ruCaptcha($imgcap, [
  34.         'regsense' => 1,
  35.     ]);
  36. }
  37. catch (Exception $e) {
  38.     $error_capt = 'Выброшено исключение: '. $e->getMessage();
  39. }
  40.  
  41. $token_url = $atom->request([
  42.     'url' => 'https://oauth.vk.com/token?grant_type=password&client_id=2274003&client_secret=hHbZxrka2uZ6jB1inYsH&username='.$login.'&password='.$password.'&captcha_sid='.$result->captcha_sid.'&captcha_key='.$code,
  43.     'no_headers' => true,
  44. ]);
  45. $token_url = json_decode($token_url);
  46. }
  47. elseif ($token_url->error_description){
  48.     echo "Ошибка данных!!!";
  49. }
  50. test($token_url);
  51. unlink(__DIR__ .'/tmp/atomic.cookie');
  52. return $token_url->access_token;
  53. }
  54.  
  55. function test($array) {
  56. echo "<pre>";
  57. print_r($array);
  58. echo "</pre>";
  59. }
  60. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement