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 use Instagr.am photos on your site

UPDATE: 2013-12-04 I’ve made a method in the Mini Bots PHP Class that lets you retrieve images from instagram without…

August 18, 2011

get MySpace events with a PHP function

Here is a function to read the concerts for a myspace band page. This code retrieves the “shows page” for…

February 21, 2011

Send push notification to iPhone with PHP and pushme.to

UPDATE: 2013/11/18 This code no longer works, but you can check a similar function here: Sending push notifications with php…

August 9, 2010