PHP post facebook page statuses

820
$data  = file_get_contents("https://graph.facebook.com/124292684247609/feed?access_token=MY TOKEN");
$data = json_decode($data, true);

print_r($data);

That's the code I've tried, since no others work. But this does neither, but still gives me no major errors. But it doesn't post facebook posts, for some reasons.

How can I post a facebook groups statuses/posts?

Edit: I cannot use the array at all

503

Answer

Solution:

$data  = file_get_contents("https://graph.facebook.com/(Page-Id)/feed?message=Hello&access_token=MY TOKEN");
$data = json_decode($data, true);

print_r($data);

you can easily post like this.

you will need permission publish_action,manage_pages;

970

Answer

Solution:

$posts = $data->data;
foreach ($posts as $post) {
    if (isset($post->id)) {
        $post->id;
        $message = (isset($post->message) ? mysql_real_escape_string($post->message) : '');
        echo $post_id.' '.$message;
    }
}

People are also looking for solutions to the problem: php - Symfony Validator Component issue in Standalone Applicatin

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.