Answer the question
In order to leave comments, you need to log in
How to get a token for vk.com using curl?
Friends, your help is needed. You need to get a token from vk.com via a link like this using curl:
$url= 'https://oauth.vk.com/access_token?client_id=<id>6&client_secret=<secret>&grant_type=client_credentials';
$token = file_get_contents($url);
print_r(json_decode($token));
stdClass Object ( [access_token] => ce06f81fce06f81fce034a4ac1ce445683cce06ce06f81f9d7cf3f6cb5400f087158620 [expires_in] => 0 )
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result=curl_exec($ch);
curl_close($ch);
print_r(json_decode($result));
Answer the question
In order to leave comments, you need to log in
Lord, I'm sorry.
As it turned out, the curl package was simply not installed on the server. This was the reason - but I did not notice the elephant.
Thanks to all.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question