PHP:
скопировать код в буфер обмена
скопировать код в буфер обмена
- class vkapi {
- function __construct() {
- $this->error(1);
- }
- }
- private $app_id;
- private $secret;
- private $token;
- 1 => "No JSON support! To use this class install JSON addon.",
- 2 => "Incorrect APP ID format! It must be numeric and contain at least 1 character.",
- 3 => "Incorrect SECRET format! It must contain at least 1 character.",
- 4 => "Incorrect APP ID or SECRET!",
- 5 => "Incorrect METHOD name, during query!",
- 6 => "Incorrect PARAMS array, during query!",
- 7 => "Authorize first!"
- );
- function auth($app_id, $secret) {
- $this->app_id = $app_id;
- $this->secret = $secret;
- $url = 'https://api.vkontakte.ru/oauth/access_token/?client_id='.$this->app_id.'&client_secret='.$this->secret.'&grant_type=client_credentials';
- $this->token = $answer['access_token'];
- $this->error(4);
- }
- } else {
- $this->error(2);
- }
- $this->error(3);
- }
- }
- }
- function query($method, $params) {
- $this->error(7);
- }
- $url = 'https://api.vkontakte.ru/method/';
- $url .= $method.'?';
- $url .= "$key=$var&";
- }
- $url .= 'access_token='.$this->token;
- return $answer;
- } else {
- $this->error(5);
- }
- $this->error(6);
- }
- }
- }
- }
- private function error($error_num) {
- }
- }