Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function request($method, $params = []) {
- list($method, $params) = $this->editRequestParams($method, $params);
- $url = 'https://api.vk.com/method/' . $method;
- $params['access_token'] = $this->token;
- $params['v'] = $this->version;
- $params += $this->differenceVersions($method);
- while (True) {
- try {
- // echo "Попытка отправить запрос...\n";
- return $this->request_core($url, $params);
- } catch (VkApiException $e) {
- sleep(1);
- $exception = json_decode($e->getMessage(), true);
- if (in_array($exception['error']['error_code'], $this->request_ignore_error)) {
- continue;
- } elseif ($exception['error']['error_code'] == 14) {
- $captcha_img = $exception['error']['captcha_img'];
- $captchaText = $this->testImageToText($captcha_img);
- $params['captcha_sid'] = $exception['error']['captcha_sid'];
- $params['captcha_key'] = $captchaText;
- return $this->request_core($url, $params);
- } else {
- throw new VkApiException($e->getMessage());
- }
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement