I am developing a facebook application that fetches the newsfeed of the logged in users and renders it. Currently, I am using iframe and I use PHP SDK to call the Graph API to fetch the posts and render them (generate on server side via PHP). To emulate the facbeook like look and feel, I mimicked their styles on which I am somewhat successful but not very much.
I am wondering is there a way in Facebook API to do the same for me? I read about the FBML but there is a deprecation warning along with a notice that they are gradually moving things towards their Javascript SDK.
Any ideas?
Well, you are narrowed to what XFBML (The Javascript API) offers you.
I had the same problem a while ago and this site saved me - http://devtacular.com/articles/bkonrad/how-to-style-an-application-like-facebook/
There are some basic styles that are used by facebook.
Good luck.
Related
Is it possible to shows posts, feeds etc in a customized manner on your website? For example if I don't want to use the plugins they provide to embed on your website which show posts in a rectangular box I want to show posts from these social media sites in different manner. For reference please visit this website and scroll down to section below Latest News and Testimonials you will find Facebook, Twitter, LinkedIn and Google+ with Lorem Ipsum text. It seems like this website has also not implemented this feature (don't know if its possible with all social sites) but I am asking if you need to implement something like this is this possible? I have to implement it on a PHP website, if that helps. Thanks for your help in advance.
Although you're asking for something different than embedding, I still believe what you're looking for is "Embedding posts". Most social sites do not want you to rebuild their stream experience and put it somewhere else -- additionally, most content policies on these sites prohibits you from caching or storing posts because it can easily become a privacy issue. Finally, if you're pulling a lot of posts, frequently, from these services, you will encounter API call limits.
The following resources should get you started with properly embedding posts so you don't have to worry about how you're caching:
Google+
Facebook
Twitter
If you (really, really) wanted to build out your own solution you should do it client-side in JavaScript, not in PHP. For this, you would need to use the following APIs:
Google+ uses the Activity API
Facebook has the Graph/Feed API
Twitter has the Search/Get Tweets API pass from%3A[username] to get specific user Tweets
If you were to try doing this in PHP, it would be easier using client libraries and starting from sample code.
Google+ PHP example
Facebook PHP client library
Twitter PHP client libraries
Make sure that you're following the content policies of the various sites you're aggregating. In other words, if you're doing something like caching the results in a MySQL database pulled using your PHP script, invalidate the cache every 3600 seconds and every time a post is no longer retrieved from your API calls.
I know this subject has been done already over and over. but... i must be stupid so i'll try to figure out my problem simply.
I have a facebook page, let s say that one :
http://www.facebook.com/pages/Medieval-Forgecom/302734029745018
with a few fan poeple.
now on my website i would like to give a discount to poeple who are fan of that page.
So i tried the php api (with an application id and secret) before discovering that this is NOT what i want as my page is not an app and has no appId neither secret. Am i misunderstanding something here?
So i m wondering how in php i can know if someone is fan or not...
If it is not possible i could use the javascript api to make this check ( wich is quite bad, it should be done somewhere via php) but even this way i get trouble with the deprecated api and the code refering to javascript inside the facebook website.
in a nutshell, i'm lost.
thanks for your time and attention.
Do some research on the concept of "fan-gate". I think this is what you're looking for.
https://www.facebook.com/note.php?note_id=10150130919053430
http://www.youtube.com/watch?v=fBBnrtG0hAw
There are three ways of using Facebook API. Social plugins are widgets such as comments or like buttons. You can put them into your site directly and easily. And then there is the Graph API. First way of using this API is to create a whole standalone Facebook application, such as Farmwille. Second way is to use it only at your site, out of the Facebook frame. Regardless of the type of your usage, you need to register an application on Facebook, so Facebook API can authorize you. Without that you can't use the API. You don't need to create a real standalone app if you want only to use the API at your own site, but you must register it and this registration is just called Facebook application. It can be virtual application representing your site.
I have a Facebook application used as a tab in a fan page, that displays different information depending on whether tha user is a fan of that page or not.
Now I've been asked to have it post a message to a user's wall if they perform certain action (follow a link or whatever), and so far I haven't found a way to do that. All the documentation I have found refers to stand alone apps, and I've even seen it suggested (in the FB forums) that you can't get the auth token from an app.
So, i still think it can be done, but how?
If a user has authorized your app, you can post to her wall using the PHP SDK. See the PHP SDK api documentation for examples.
All apps have to be iframe apps now, so loading the JS sdk should be fine.
You have to get permissions first ->
http://developers.facebook.com/docs/authentication/#applogin
Then you can post using php with what Dhiren said, or, post with the fb.api function with JS ->
http://developers.facebook.com/docs/reference/javascript/FB.api/
Let me know if you need an example script.
Cheers
i like to post to my FB Fan Page, Some Content using cron job in PHP,How can i do that?
Can you gave me example?
After becoming familiar with the Graph API check out Facebook's documentation for Pages
http://developers.facebook.com/docs/reference/api/page/
Here is the main page for Facebook's Graph API documentation
http://developers.facebook.com/docs/api
For PHP Development, check out this SDK, It will make your life much easier for interacting with Facebook using PHP
https://github.com/facebook/php-sdk/
Here is a link for how to configure your Facebook APP to be able to post on a Facebook Page
http://blog.theunical.com/facebook-integration/5-steps-to-publish-on-a-facebook-wall-using-php/
(I did not follow this exact tutorial but slaved to figure it out myself, so let me know how it works for you)
note As I mentioned in a below comment make special note of the permanent session key.
IU am trying to create my first Application running inside an Facebook Canvas/IFRAME. I am using
Zend Framework (PHP) for this project.
But I am not able to understand all the different ways facebook is offering.
There is an PHP SDK wich works so far. There is an Javascript SDK and something called FBJS? Does someone know a good point to start? The Documentation is not up to date most times.
I have managed it to login, and show my picture and name inside the app, the basic stuff is working.
Canvas App - facebook puts your code directly to the page (well, kind of), you have access to FBML (facebook specific tags), limited HTML, CSS (cached on Facebook side) and limited JS known as FBJS (a wrapper for native JS commands for security reasons, no jquery or anything like that). Your canvas app is still hosted on your server though, and you can use Facebook PHP API on a server side (and anything else you wish, it's a page on your server).
Frame App - facebook just puts an iframe on the page embedding some page on your server. Iframe could contain anything you want, it is just a regular page with no extra requirements. You can use HTML, JS (jquery etc), Facebook PHP API on server side. There is no FBJS as it is not needed, but you can use JS API (with similar functionality to PHP API, only for frontend). FBML is not directly supported, but you can use FBML tags on any site after declaring them:
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
Advantages of using Canvas App - no annoying iframe scrolling, quick access to FBML, and more close integration as a whole.
Facebook JS is how you can use your own javascript in a facebook page, without colliding with or interfering with facebook. It does this by rewriting your javascript, therefore you need to work around how the javascript is rewritten, and use facebook's provided library for ajax and events, not your own such as jQuery, and in a lot of cases, not even the browser's native api.
The javascript SDK allows you to access facebook data from another site using javascript. The Social Graph API has increased the potential for this access, and also has expanded it's power.
Serverside data access = through the provided php api.
Clientside data access = through the javascript SDK.
FBJS, on the other hand, is facebook's adoption of javascript for canvas applications.