Finally got publishTemplatizedAction working...with php

Jun 16, 2009 at 1:06 PM

After weeks of struggling with this toolkit, I finally gave up, signed up for a FREE Joyent hosting account, followed the simple step by step instructions, and after about 5 or 6 hours, I was done. I am not a php developer. It was like breathing fresh air after stepping out of a smoke filled room. For those of you who are curious, this is the code...


$facebook = new Facebook(key,secret);

$fb_user = $facebook->require_login();
Hello <fb:name uid='<?php echo $fb_user; ?>' useyou='false' possessive='true' />! Welcome to my first application!<br>
$news_title = "News Item";
$news_url = "";
$news_img = "";
$news_text = $_GET['message'];
$page_id = "177395875231"; /* Facebook Page ID */

$feed_title_template = '{actor} posted {headline}';
$feed_title_data = '{"headline":"' . $news_title . '"}';

$feed_body_template = $news_text;

$feed_image = $news_img;
$feed_image_link = $news_url;

$facebook->api_client->feed_publishTemplatizedAction($feed_title_template, $feed_title_data, $feed_body_template, "", "", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, $page_id);




Aug 5, 2009 at 11:20 PM

Hi Jypelton. I haven't checked this forum for a while, but just saw this post.

Well done getting it going with PHP, and thanks for posting here.

My ASP.NET app has been published, and is going fairly well, after all the trials (yes, weeks) of getting past the basics. I still haven't worked out the feed. I personally prefer ASP.NET to PHP, but the Facebook support for PHP is much better, as you've discovered.

Hope it all goes well for you,


Aug 6, 2009 at 2:32 AM

Just to verify, publishTemplatizedAction won't work as News feed, it will only appear in the recent activity on user wall. Use News feed form or publishStream instead if ever wish to devleope News Feed.