s-anasol / vk
The PHP class for vk.com API. With HTTP proxy and captcha recognition via antigate support
Installs: 20
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 89
pkg:composer/s-anasol/vk
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2025-12-21 02:55:53 UTC
README
The PHP class for vk.com API and OAuth.
Features: HTTP proxy, captcha recognition via antigate, api response timeout limit
Use
-
Install via composer
composer require s-anasol/vk -
Create VK object
-
without authorization
$vk = new VK\VK('{APP_ID}', '{API_SECRET}'); -
with authorization
$vk = new VK\VK('{APP_ID}', '{API_SECRET}', '{ACCESS_TOKEN}');
-
-
If need authorization
-
Get authoriz link
$vk->getAuthorizeURL('{API_SETTINGS}', '{CALLBACK_URL}'); -
Get the token access by code from the authoriz link
$vk->getAccessToken('{CODE}'); -
Check the status of authorization
$vk->isAuth(); // return bool
-
-
Usage API
$vk->api('{METHOD_NAME}', '{PARAMETERS}'); -
Captcha recognition
$vk->setAntigate('antigate-key');
$vk->setCaptchaSavePath('./captcha'); // YOU MUST create 'captcha' folder at project root path
Class methods
$vk->setApiVersion({NUBMER});- set api version$vk->setProxy("1.2.3.4:8080");- set HTTP proxy for API requests$vk->setTimeout(10);- set API Response timeout$vk->setAntigate("antigate-key");- set antigate API key to resolve captcha$vk->setCaptchaSavePath("/tmp");- set temporary captcha image save path
Variables
{APP_ID}— Your application's identifier.{API_SECRET}— Secret application key.{ACCESS_TOKEN}— Access token.{API_SETTINGS}— Access rights requested by your app (through comma).{CALLBACK_URL}— Address to which{CODE}will be rendered.{CODE}— The code to get access token.{METHOD_NAME}— Name of the API method. All methods.{PARAMETERS}— Parameters of the corresponding API methods.
* If you need infinite token use key offline in {API_SETTINGS}.