PHP to post on a Facebook page

Hi, I’ve modified the Mini Bot Class, I’ve fixed the Facebook status update and I’ve implemented the function to post…

July 28, 2010

Hi, I’ve modified the Mini Bot Class, I’ve fixed the Facebook status update and I’ve implemented the function to post on the wall of a facebook page: suppose you have a page of a brand, and you need to update it regularly with a cron job… Very, very usefull, isn’t it?

Nothing more to say. Just download the class from Mini Bot Class page and search for setFacebookStatus method and postToFacebookPage method.

Author

I'm a software engineer, an everyday web developer and a maker. I usually build sites with PHP, within or without WordPress. I build Internet of Things with Arduino and ESP8266. I'm the founder of Rockit.it and Dailybest.it and I'm actually the Chief Technical Officer of Better Days web agency.

Comments on “PHP to post on a Facebook page”

3 thoughts

  1. TI says:

    Many thanks, looking like such a simple and effective solution.

    My example use:
    define (‘FACEBOOK_EMAIL_LOGIN’, ‘xxxxx’);
    define (‘FACEBOOK_PASSWORD’, ‘yyyyy’);

    define (‘FACEBOOK_DEBUG’, false);

    require_once ‘includes / minibots.class.php’;
    $ M = new Minibots ();

    if (isset ($ _GET [‘status’])) (
    $ M-> setFacebookStatus ($ _GET [‘status’], FACEBOOK_EMAIL_LOGIN, FACEBOOK_PASSWORD, FACEBOOK_DEBUG);
    )

    if (isset ($ _GET [‘post’])) (
    $ M-> postToFacebookPage ($ _GET [‘post’], ‘wall.php’ FACEBOOK_EMAIL_LOGIN, FACEBOOK_PASSWORD, FACEBOOK_DEBUG);
    )

  2. David says:

    Howdy,

    Nice work, I like it.

    A couple of points. The Facebook Page status update is currently marred by the fact that the Facebook mobile site seems to (incorrectly?) post messages to your own wall, not the page. The action in the form is always /home.php rather than the page URL.
    It may be further complicated by the different permissions – an owner, vs someone who just ‘likes’ a page.

    Also, you’re using cookies but you’re not actually saving/reusing them – curl only sets cookies once you curl_close($ch)

    I’ll let you know when I’ve found a fix for the Facebook Page posting.

  3. sancora says:

    not work….

Comments are closed

Recommended

PHP bot to get wikipedia definitions

Wikipedia, the collaborative and multilingual encyclopedia project, has a lot of usefull terms defined in its database, you can find…

August 29, 2010

PHP curl bot to update Facebook status

I’ve found this great mini bot from Alste blog, and I’ve decided to add it to the mini bot class.…

March 1, 2010

How to read facebook likes count from PHP

When you add facebook like button to your site, probably, you also want to save the number of likes of…

October 8, 2012

How to change twitter status with php and curl without oAuth

Twitter api authentication Since the 31 of august 2010, twitter made its API more secure, stopping basic authentication calls. So,…

September 9, 2010

Social buttons: the fastest way for WordPress, without plugins

NOTE: the code in this post is written for WordPress but you can easily translate it in any language. You’re here…

September 15, 2015

VK Social metrics, Top Stories plugin now with support for Vkontakte

VK SOCIAL METRICS VK.COM, also known as Vkontakte, is an important russian social network, which has over 270 million users.…

November 19, 2014