Commit eb56fe1a authored by Alex Ne's avatar Alex Ne

while get token

parent acf8163b
...@@ -28,8 +28,11 @@ class ServerToken extends VKAPI { ...@@ -28,8 +28,11 @@ class ServerToken extends VKAPI {
$params["client_secret"] = $this->Credentials->get_client_secret(); $params["client_secret"] = $this->Credentials->get_client_secret();
$params["grant_type"] = "client_credentials"; $params["grant_type"] = "client_credentials";
$params["v"] = $this->Credentials->get_api_version(); $params["v"] = $this->Credentials->get_api_version();
$data = false;
$data = $this->query($this->oauth_url . "access_token", $params); while ( ! $data) {
$data = $this->query($this->oauth_url . "access_token", $params);
if ( ! $data) {sleep(1);}
}
if (isset($data["access_token"])) { if (isset($data["access_token"])) {
$this->server_token = $data["access_token"]; $this->server_token = $data["access_token"];
} else { } else {
......
...@@ -54,10 +54,10 @@ class VKAPI { ...@@ -54,10 +54,10 @@ class VKAPI {
$ClientResponse = $Client->exec(); $ClientResponse = $Client->exec();
if ($data = $ClientResponse->json_decode()) { if ($data = $ClientResponse->json_decode()) {
return $data; return $data;
} else { } #else {
return $ClientResponse->get_body(); #return $ClientResponse->get_body();
} #}
return; return false;
} }
} }
?> ?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment