Seemingly it supposed to be https://github.com/facebook/php-sdk/. However, I am suspicious either it so because getLoginUrl method generates not the type of URL that is described in http://developers.facebook.com/docs/authentication/.
So I was wondering which of these is outdated?
The PHP SDK that you linked is up to date. It is a client for the various Facebook APIs, including the Graph API, the "old" REST API, and others. Right now, getLoginUrl() does generate a URL that has been used for longer than the OAuth documentation has existed, but the end result will be the same for you. If you do have a problem with that login URL for some reason, you're free to implement authentication any way you like by replacing or extending the existing SDK logic.
Remember, APIs and SDKs are not the same thing. The PHP SDK is just one API client. Everything in the official FB docs should be considered up-to-date, as they've all been revamped this year.
OAuth based authentication and Graph Api for data are the latest ones.
http://developers.facebook.com/docs/authentication/
see this also:
http://developers.facebook.com/docs/reference/rest/
Related
I am using PHP 5.3.8, therefore I can't use the latest Facebook SDK which works only with PHP 5.4.X.
given a url, I'd like my server to tell if this is a facebook-like-page, or not.
Do I have to use OAuth? I used to use the graph-api, but now I get all weird errors. like no access-token provided, no authorization etc.
My code was using cURL with GET and accessed https://graph.facebook.com/.urlencode("THE_PAGE_URL");
I don't know if this is not an overkill to do a whole authorization from my server, and if so, to whom? I must say I am lost in the facebook documentation, frankly.
I tried this sample code from Facebook, which does not work at all.
Is there a simple way to get info about a public like-page from facebook?
An easy way to make calls using the Facebook Graph API is with their Graph API Explorer.
You have to be logged into your Facebook developer account to access it obviously, but it is really helpful if you're experimenting with making different calls to a Facebook page.
Regarding oAuth, I would also highly recommend that you obtain a permanent page access token. It's the best way to mitigate the complexities of Facebook's oAuth process.
facebook: permanent Page Access Token?
I'm using this code https://github.com/google/google-api-php-client the user-example.php in the examples folder, to make some tests on Google plus signin.
Everything worked well, except one thing. After the connection, i obtained this url :
http://MYURL/?code=4/vt_b0DsUU91UOYkB3ozIp-ZLITiL2irzaaUzyvtdph4.4gAL4kfDZGUVJvIeHux6iLafIxOglAI
My question is, where can i get the user email ?
Thanks
TL;DR: Fully working solution: Get Userinfo from Google OAuth 2.0 PHP API
You're using offline flow which is described in details here: https://developers.google.com/accounts/docs/OAuth2WebServer#handlingtheresponse
At this point you got code.
vt_b0DsUU91UOYkB3ozIp-ZLITiL2irzaaUzyvtdph4.4gAL4kfDZGUVJvIeHux6iLafIxOglAI
This code needs to be exchanged for access_token.
Exchanging code for access token using Google Library: https://github.com/google/google-api-php-client/blob/master/examples/user-example.php#L66
With access_token you can send api requests.
I have been trying to implement the new scope features that were recently added to the LinkedIn API. I am currently using the "simple-linkedinphp" library for as my LinkedIn oauth lib (http://code.google.com/p/simple-linkedinphp/ ).
Following the directions on the LinkedIn docs, I added the "scope" param to my request token URL as such:
const _URL_REQUEST = 'https://api.linkedin.com/uas/oauth/requestToken?scope=r_basicprofile+r_emailaddress';
However, this had little effect. I still get the same o-auth dialogue as before without any additional permissions for the e-mail address. Anyone get this working correctly in PHP yet? Any help here would be appreciated.
You need to create new Application API keys and use those to see the updated authentication screens.
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.
I want to show my latest tweet in a web page. My tweets are private for some reason and I should login to Twitter. I know that the basic HTTP authentication was deprecated in August 2010. How can I provide authentication in my PHP code to fetch private tweets (or userTimeline if I'm not mistaken)?
I've searched but unfortunately didn't find anything useful! :( Thanks in advance for your help!
Jan, I heard about ZendFramework while I was searching for the answer but It's complicated for me.
I found the solution here that illustrates how I can use OAuth based on Abraham’s Twitter OAuth library.
The key note is that I stored my 'oauth_access_token' in a database or somewhere else immediately after first login via my twitter credential. Then I remove the code which allow users to login to twitter and reuse stored credential to fetch the latest tweet by using $user->status->text variable.
It's a geeky job. It maybe has some potential security flaws but I'm not sure! ;)
By the way, Thanks a lot for your reply, Jan! :D
Authentication to Twitter is done via OAuth. A pretty simple way to access your Twitter account with PHP is using the latest version of ZendFramework. It will be required to register your app on twitter, which allows you to generate an oauth token. This token can be used to access your private twitter feed.
See documentation of Zend_Service_Twitter and Zend_Oauth_Consumer.
Here http://framework.zend.com/manual/en/zend.oauth.introduction.html you will find a pretty good introduction of using Zend OAuth together with twitter (note that the address used in the $config array has to be api.twitter.com/oauth and NOT twitter.com/oauth )
However, you can also make your Tweets public in your twitter account settings (Settings -> Account -> Tweet Privacy -> Uncheck "Protect my tweets"). Then your tweets will be available on the public timeline (not at once, you may have to wait a bit).
Hope that helps!
-Jan