Но ничо не работает
- <?php
- $vkontakteApplicationId = '3018556';
- $vkontakteKey ='***********';
- // ID юзера, к которому должно подключаться приложение
- $vkontakteUserId='********';
- if (!empty($_GET['code'])){
- // вконтакт присылает нам код
- $vkontakteCode=$_GET['code'];
- // получим токен
- $sUrl = "https://api.vk.com/oauth/access_token?client_id=$vkontakteApplicationId&client_secret=$vkontakteKey&code=$vkontakteCode";
- // создадим объект, содержащий ответ сервера Вконтакте, который приходит в формате JSON
- $oResponce = json_decode(file_get_contents($sUrl));
- $fp = fopen('token.txt', 'w');
- fputs($fp, $oResponce->access_token);
- fclose($fp);
- //////////////////////////////////
- $vkontakteAccessToken = file_get_contents('token.txt');
- $text = urlencode('Тест');
- $link = 'http://cuns.ru';
- // строка запроса к серверу Вконтакте
- $sRequest = "https://api.vk.com/method/wall.post?owner_id=$vkontakteUserId=&access_token=$vkontakteAccessToken&message=$text&attachment=$link";
- // ответ от Вконтакте
- $oResponce = json_decode(file_get_contents($sRequest));
- var_dump($oResponce);
- }
- ?>
- <a href="http://oauth.vk.com/authorize?client_id=<?=$vkontakteApplicationId?>&scope=offline,wall&redirect_uri=http://cuns.ru/qw/connect.php&response_type=code">Тест</a>
возвращает
object(stdClass)#2 (1) { ["error"]=> object(stdClass)#3 (3) { ["error_code"]=> int(7) ["error_msg"]=> string(43) "Permission to perform this action is denied" ["request_params"]=> array(6) { [0]=> object(stdClass)#4 (2) { ["key"]=> string(5) "oauth" ["value"]=> string(1) "1" } [1]=> object(stdClass)#5 (2) { ["key"]=> string(6) "method" ["value"]=> string(9) "wall.post" } [2]=> object(stdClass)#6 (2) { ["key"]=> string(8) "owner_id" ["value"]=> string(9) "82645017=" } [3]=> object(stdClass)#7 (2) { ["key"]=> string(12) "access_token" ["value"]=> string(63) "6110b63c65fda62565fda625e265d3a919665fd65fca625f445c798ac9826d4" } [4]=> object(stdClass)#8 (2) { ["key"]=> string(7) "message" ["value"]=> string(8) "Тест" } [5]=> object(stdClass)#9 (2) { ["key"]=> string(10) "attachment" ["value"]=> string(14) "http://cuns.ru" } } } }
убиваюсь уже несколько дней, подскажите, в чем дело ?