1

カスタムアクションをタイムラインに投稿するために、次のことを試みています。Graph API Explorer を使用しても同じ効果が得られます。

    $facebook = new Facebook(array('appId' => '123456789',
                                    'secret' => '123456789',
                                    'cookie' => true));
    $access_token = $facebook->getAccessToken();

    if($access_token != "") 
    {
        $user = $facebook->getUser();

        if($user != 0)
        {
            $queries = array(array("method" => "POST", "relative_url" => "/me/namespace:action?object=http://www.mysite.com/url/parameters"));

            try 
            {
                $postResponseA = $facebook->api("?batch=".json_encode($queries), "POST");
            } catch (FacebookApiException $e) 
            {
                echo 'AF error: '.$e;
            }
        }
    }

エラーはスローされません。しかし、何も投稿されていません。

print_r($postResponseA) は次のことを示しています。

Array ( [0] => Array ( [code] => 400 [headers] => Array ( [0] => Array ( [name] => Access-Control-Allow-Origin [value] => * ) [1] => Array ( [name] => Cache-Control [value] => no-store ) [2] => Array ( [name] => Connection [value] => close ) [3] => Array ( [name] => Content-Type [value] => text/javascript; charset=UTF-8 ) [4] => Array ( [name] => Expires [value] => Sat, 01 Jan 2000 00:00:00 GMT ) [5] => Array ( [name] => Pragma [value] => no-cache ) [6] => Array ( [name] => WWW-Authenticate [value] => OAuth "Facebook Platform" "invalid_request" "An active access token must be used to query information about the current user." ) ) [body] => {"error":{"message":"An active access token must be used to query information about the current user.","type":"OAuthException","code":2500}} ) ) 
4

0 に答える 0