s-anasol / vk
The PHP class for vk.com API. With HTTP proxy and captcha recognition via antigate support
v0.2.1
2016-09-29 10:24 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2025-06-21 23:59:40 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}
.