Facebook - how to easy post to wall
Very easy setup for publishing a post with a facebook app.
This is written symfony 1.4 like, but can easily adopted for any kind of framework (or PHP plain too )
- Download and include ( https://developers.facebook.com/docs/reference/php/ )
- Create a facebook app and setup facebook login ( out of topic of this protip )
-
Let's initialize facebook api:
$options = array( 'appId' => sfConfig::get('app_facebook_app_id', null), 'secret' => sfConfig::get('app_facebook_secret', null), ); $facebook = new Facebook($options);
-
Let's call the api:
$facebook->api("/me/feed" , "post" , array( "message" => "Wonderful message", "link" => "http://wonderful.link", "picture" => "http://wondeful.link/wonderful.image.png", "name" => "Check this out!", "caption" => "The coolest app on the Earth. Maybe on the Moon too", "description" => "What are you waiting? Let's do it now. Let's kill the Purple Tentacle!" , ));
Check your wall. You're done!
Written by pleone
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#