Hope you have already went through the tutorial on Facebook Connect implementation in Codeigniter. This is the continuation of that tutorial. Once user is authenticated with the Facebook connect, you can invoke any methods mentioned in the Facebook Graph API at http://developers.facebook.com/docs/reference/api/. Here we will explore the method, which is used to publish post a post to the user's wall on Facebook. In the previous tutorial we have created a Facebook connect library. Please add the following method to the library. If user is not logged in or has no access to post then this function will return false.
function post_to_wall($message,$link="",$photourl="")
{
if($this->fbSession)
{
$param = array('message'=>$message,'cb' => '');
if($photourl!="")
{
$param["picture"] = $photourl;
}
if($link!="")
$param["link"] = $link;
$posts = $this->fb->api('/me/feed','post',$param);
return TRUE;
}
else
{
return FALSE;
}
}
Similarly if you want to retrieve all the posts in the user's wall, then use "me/home" instead of "me/feed" in the above function. Learned something? For complete reference of the available functions refer the Facebook Graph API.
Hope you have already went through the tutorial on Facebook Connect implementation in Codeigniter. This is the continuation of that tutorial. Once user is authenticated with the Facebook connect, you can invoke any methods mentioned in the Facebook Graph API at http://developers.facebook.com/docs/reference/api/. Here we will explore the method, which is used to publish post a post to the user's wall on Facebook. In the previous tutorial we have created a Facebook connect library. Please add the following method to the library. If user is not logged in or has no access to post then this function will return false.
function post_to_wall($message,$link="",$photourl="")
{
if($this->fbSession)
{
$param = array('message'=>$message,'cb' => '');
if($photourl!="")
{
$param["picture"] = $photourl;
}
if($link!="")
$param["link"] = $link;
$posts = $this->fb->api('/me/feed','post',$param);
return TRUE;
}
else
{
return FALSE;
}
}
Similarly if you want to retrieve all the posts in the user's wall, then use "me/home" instead of "me/feed" in the above function. Learned something? For complete reference of the available functions refer the Facebook Graph API.
Do you know that you can generate a complete PHP websites in minutes with PHP Website Generator?