Add picture on facebook wall using php

November 1, 2009 · 21 Comments
Filed under: FaceBook Integration, Featured, PHP 

First Follow the 5 Steps from my Previous post http://blog.theunical.com/facebook-integration/5-steps-to-publish-on-a-facebook-wall-using-php/ then in last program include the below code to publish a photo and also meta data on a facebook wall.

Publishing a Post Containing an Image, Action Links and Custom Metadata





$message = 'Check out this cute pic.';

$attachment = array( 'name' => 'i\'m bursting with joy',
'href' => 'http://icanhascheezburger.com/2009/04/22/funny-pictures-bursting-with-joy/',
 'caption' => '{*actor*} rated the lolcat 5 stars', 'description'
 => 'a funny looking cat', 'properties' => array('category'
 => array( 'text' => 'humor', 'href' =>
'http://www.icanhascheezburger.com/category/humor'), 'ratings' => '5 stars'),
 'media' => array(array('type' => 'image', 'src' =>
 'http://icanhascheezburger.files.wordpress.com/2009/03/funny-pictures-your-cat-is-bursting-with-joy1.jpg',
 'href' => 'http://icanhascheezburger.com/2009/04/22/funny-pictures-bursting-with-joy/')),  'latitude' => '41.4',
 //Let's add some custom metadata in the form of key/value pairs 'longitude' => '2.19');
$action_links = array( array('text' => 'Recaption this',
 'href' => 'http://mine.icanhascheezburger.com/default.aspx?tiid=1192742&recap=1#step2'));
 $facebook->api_client->stream_publish($message, $attachment, $action_links);

Exiting isn’t it.

–Steven