Facebook张贴到墙上。如何?

时间:2012-07-18 10:35:57

标签: php facebook oauth-2.0 facebook-wall

嗨,大家好我的“POST TO WALL”有很大的问题。有人可以告诉我该怎么做吗?

<?php

 $app_id = "myappid";

 $canvas_page = "mycanvaspage";

 $auth_url = "https://www.facebook.com/dialog/oauth?client_id=" 
        . $app_id . "&redirect_uri=" . urlencode($canvas_page);

 $signed_request = $_REQUEST["signed_request"];

 list($encoded_sig, $payload) = explode('.', $signed_request, 2); 

 $data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);

 if (empty($data["user_id"])) {
        echo("<script> top.location.href='" . $auth_url . "'</script>");
  ?>

我知道如何使用对话框窗口建立一个POST TO WALL,但有人可以告诉我如何使用它吗?

1 个答案:

答案 0 :(得分:0)

使用facebook php lib,并发布流权限:

try {
     $facebook -> api ('/' . $fbID . '/feed', 'POST', $post);
       #where $post is array like array('name' => 'test' , 'description' => 'test');
    } catch (FacebookApiException $e) {
     #if eny error
         #u can get it $e -> getMessage() 
    }