Posting to facebook timeline from an external site - php

Scenario: While logged into facebook, I click on a share link on my site. It pops up the dialog to post to my timeline.
Question: Is it necessary to create an app to do this? Or does facebook offer an app that will request permissions to do this for you?
My current plan is to use the facebook graph API with the php sdk to ask for the proper permissions, build the timeline POST request with an access_token. I just wasn't sure if there was an easier way to do this. Thanks!

Graph API is all that you need. Your server needs to support OAuth 2.0 authentication.
Add the URL of the script that handles this in the configuration page of your FB app.
Request for an access_token with offline_access permission. (offline_access allows you to post to user's timeline even when he is not logged on). With the access_token, do a HTTP/POST with params message and access_token to https://graph.facebook.com/me/feed as shown here.
NOTE: FB is deprecating offline_access from May 1, 2012. Check this.

Related

how to read facebook profile timeline feed with Graph API?

I am using Facebook PHP-SDK v5 with Facebook Graph API v2.10 and by other code i am able to get data from facebook page easily, but what i need is to fetch data of user profile wall ,
from facebook Graph Explorer i am able to read those data by generating token. but not by code.
it will throwing error
URL blocked: This redirect failed because the redirect URI is not white-listed in the app's client OAuth settings. Make sure that the client and web OAuth logins are on and add all your app domains as valid OAuth redirect URIs.
and i have used localhost url in the app oAuth setting as well,
I wanted to read someones wall post feed after authorize him by my applications, i dont want to read my own profile like api('/me/feed'
does anyone help me in this case.

how to create a PHP REST API Client to get the user logged in on the server?

i want to create a php web app with REST API.where user logins on the Server/Main site.
problem is that how to get current logged in user on a php client.i am using CURL at client to get data from server.
if i store a user cookie in browser when user logins on my site, then client can't access them
because CURL doesn't send cookies when requesting. if i use CURL COOKIEJAR or COOKIEFILE, they
will not safe since a client can store cookies data and use them for access user's account.
i want my API to be like Facebook API. how FB API knows who is currently logged in?
i only want to know is there any way to get the currently logged in user on server site.either by cookie or by session.
please someone help me
thanks
Facebook API and Twitter API uses Oauth
http://oauth.net/
Oauth is awesome for the man in the middle login. Oauth connect the user with the final server and to the server in the middle it gives a token, that token is the way to know who is logged.
https://developers.facebook.com/docs/reference/dialogs/oauth/

oAuth authentication on every site visit

I'm trying to implement a transient oAuth authentication for a web app I'm creating. Essentially, the user needs to login with the Service each time they visit my web app. Primarily it's to enable using the web app without me having to store any of the user's authentication data. I'm trying to use the Tumblr API.
My platform of choice is PHP. However I've never really worked with oAuth before and and am still learning. The following scenario illustrates what I'm trying to achieve:
The scenario assumes that:
The user has already authorized my application in their Tumblr account.
Using my Tumblr Consumer Key, Tumblr Consumer Secret, I call to get request_token, which I later display to the user via a link.
Now on clicking the link above, I expect Tumblr to NOT to ask user to allow the app again (authorize in their account) and simply redirect user back and returning some info that will allow me to distinguish the user. There is no $_SESSION as user is trying login to the website using Tumblr
Is this even possible? If yes, can you help me figure out how to get this done?
Ps. I'm a complete oAuth Noob so please be gentle :)
If you are trying to use Tumblr in a way similar to Facebook Connect, Tumblr does not offer this feature at the moment. ie: you can not use Tumblr to log into your site.
Tumblr's OAuth implementation will allow you to have the user allow access for your app to the users account indefinitely. Which means that your app will always be able to access the users account, whether they are logged into your site or not. They will still have to log into your site each time they want to access your app.
Here is a solid guide to OAuth. Tumblr uses OAuth 1.0 :
http://hueniverse.com/oauth/

Facebook, twitter, youtube livestream on website

I'm trying to create a live stream of comments and disscussions from a twitter, facebook, and youtube page for a social site. Has anyone ever done this before, if so any advice or websites/articles to check out. I'm thinking PHP curl?
You'll probably need permissions from user (application permission request) and then request
https://graph.facebook.com/me/feed?access_token=...
where access_token is token returned from facebook after aproving permissions

PHP Facebook API

Aarg, can't find a good answer to this question:
How can I auto-login on Facebook (knowing the username/password from a user) and then post a message on the wall? I already downloaded facebook.php, base_facebook.php and other files, but I don't how I can get this working...
You will need to create a facebook app. This will give you the appId and secret that are required to do most things with the graph api.
You don't even need the username and password of the user, they can authorise your app to post to their wall.
You can find all the info https://developers.facebook.com/docs/
You can use the facebook graph api and oauth to post on the facebook wall of a user.
Facebook's API does not support authentication via a user's email and password. You don't need facebook.php, or base_facebook.php. What you need is PHP and cURL to mimic browser HTTP requests and login to Facebook manually.
Try logging in to http://m.facebook.com and use Firefox's Firebug Addon or Chrome's Developer Tools to monitor browser requests.

Categories