0

我在 VK (vKontakte) 上注册了一个独立应用程序,通过我的服务器向用户配置文件发布状态消息。

在我授权用户配置文件并获得有效的令牌和用户 ID 后,我尝试通过 PHP 和 OAuth2 将状态更新发布到 VK 墙,但收到此错误:

Permission to perform this action is denied for non-standalone applications: you should request token using blank.html page

我的应用程序是一个独立的应用程序,错误消息的原因可能是什么?

4

1 回答 1

1

now to post to users wall this is the code

curl( 'https://api.vk.com/method/wall.post?owner_id='.$user_id.'&friends_only=&from_group=1&message='. urlencode( $message ) .'&attachments='.$url.'&access_token='. $token );

to post to a page you need the page number example vk.com/public111111 and the code example is(PS:this time owner id must be negative with page number -111111)

curl( 'https://api.vk.com/method/wall.post?owner_id=-111111&friends_only=&from_group=1&message='. urlencode( $message ) .'&attachments='.$url.'&access_token='. $token );

and the curl function here

function curl( $url ) {
        $ch = curl_init( $url );
        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
        curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
        curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );

        $response = curl_exec( $ch );
        curl_close( $ch );
        echo $response;
        return $response;
}

thats it. you can learn the rest all by yourself.

于 2014-09-03T04:53:30.830 回答