LucasFerreira LucasFerreira - 5 months ago 19
PHP Question

How to auto share a post on facebook timeline?

I have a website that uses the Group Buying Site plugin (http://groupbuyingsite.com). It uses facebook app to login and register.

When I add a new item to the cart the user is redirected to

cart.php
and the function
add_item($product_id, ...)
is called. I want to know if there is a way that when I enter this page I automatically share a post on facebook timeline.

Thanks.

Answer

Assuming you have the access token, I suggest you try this:

$result = $facebook->api(
    '/me/feed/',
    'post',
    array('access_token' => $access_token, 'message' => 'Your Post here')
);