Multilingual fan pages - php

I've got an algorism that is calling the Graph API to grab the posts of fan pages that we don’t have in our database (to make statistics on them).
We call the Graph API with an app token, and with “normal” fan pages (no located posts), we don’t have any problems, we correctly have all posts.
But when we try to grab country located posts, the Graph API returns to us nothing. I think it’s due to the fact that an application don’t have a language (by default), so to resolve that, I take the access token of an admin of the page and then the Graph API give me all the data I need.
My question is simple : Is there a way to grab country located data with app token ?
Thank you for your answers !

Unless you own that page, no, there is no way. This would create a privacy issue where the Graph API can be used to display otherwise restricted content. This applies to age and alcohol restrictions as well.

Related

How to get a facebook page access token without getting my app reviewed?

I am trying to fetch the latest Facebook posts from our company's page to show them on our website. It already worked until a few weeks ago, Facebook unfortunately changed some of their security guidelines. Initially I sended some requests to the Facebook Graph API using PHP, the App ID, the App Secret and the User Token to create an page accesstoken and fetch my company's posts.
Thanks to the new guidelines new created Apps do not have the "manage_pages" permission you need to create an page accesstoken. To recieve this permission you have to get your App reviewed by Facebook which seems quite laborious to me.
Can you think of another way to fetch my posts? I mean those are posts from a page I created. I do not really understand why there are so many security issues.
Thanks!
You don’t need to get your app reviewed, if it is not intended to be used by the general public.
App Development FAQ: My app is only used by a small number of people, who are all listed in the Role section of the App Dashboard - do I need to go through Login Review?
No, it does not have to be reviewed. If your app is only used by a very limited number of people […] it's completely normal to list them all as having different roles in your app's dashboard. They can be listed as Admins, Developers or Testers
Instead of using "https://graph.facebook.com/v2.8/me?..." to fetch just posts from my own pages I am now using following URL to fetch any public posts:
"https://graph.facebook.com/v2.8/{PAGE-ID or PAGE NAME}?fields=
name,picture,feed.limit(100){full_picture,created_time,message,likes,
comments,type,link}&access_token={USERTOKEN}"

Custom display of posts of Facebook, Twitter, Linkedi and Google+ on your website

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.

Get facebook posts/events/news/gallery with javascript (or php) inside my website

I'm tryin to develop a (almost) 100% client-side dynamic website by integrating it with twitter, facebook and flickr.
I've been able so far to get the last 4 tweets (with javascript) from my client's feed, and now i was wandering if i could do the same with facebook's gallery and events from their feed.
Especially, what i need (given the facebook username/api key/whatever)
gallery
for each gallery in user's profile:
get the gallery name
get the first picture
get the gallery url
news/events
for each news/event/post in user's profile:
get the event name
get the event text
get the event picture (if provided)
get the event url
I don't want to use the facebook widgets with their rendering, i just need to read the json response (if there's any) and put the data inside my website (like a preview).
Since my client is pretty rusty with "computers (cit.)" but he's (not so strangely) comfortable with facebook/twitter/flickr, i tought about a solution like this before adding a database and an admin interface to our website.
I found some resources online, so i think it's possible (in a way or another). I'd like to do it in javascript, but if it's php i won't complain.
Check out this API to get photoes from the user profile
http://developers.facebook.com/docs/reference/api/album/
This is for events
http://developers.facebook.com/docs/reference/api/event/
You can use either the PHP or the Javascript API SDKs:
http://developers.facebook.com/docs/reference/php/
http://developers.facebook.com/docs/reference/javascript/
respectively. Naturally you would handle the returned information differently. Both have a method called api() which can be utilised to grab the album and event objects (as mentioned in another answer):
http://developers.facebook.com/docs/reference/api/album/
http://developers.facebook.com/docs/reference/api/event/
You can pass parameters in the methods to restrict the results returned by fields, number of items, sizes of images etc. This is outlined here:
http://developers.facebook.com/docs/reference/api/
But the issues you are going to face is that you have to authorise your "app" - think website when they use the terminology "app" - to give it permissions to access the information. This takes the form of a two step process. You have to create the app on the Facebook platform which can then access the API methods (only certain information can be got from the API methods without an authenticated app).
The second part is that the user themselves must then authenticate their facebook account against your app - this gives your app permission to access the user's information. In plain English it would go like this:
User visits your webpage; user must be logged into Facebook and must approve your app (this used to be called Facebook Connect for obvious reasons); the app and the user account are "connected"; the app can then use the api methods you've written to return information about the connected user
The beginning explanations of how to do this are here:
http://developers.facebook.com/docs/authentication/
The only way you can access a user's (non-public) information from outside of Facebook is via a connected app and user profile.

Facebook api - PHP / Javascript and OpenGraph

I'm very confused so I hope that my question will make sense.
I'm working with the facebook API, and so far I've implemented login and a post to the users wall via php. I know read a bit more about the OpenGraph system, and the meta tags that you're supposed to put in your site, but I'm not quite grasping the concept og how to get my site fully PHP integrated with Facebook.
I have another login system which I've hooked facebook up to, so switching to javascript only will not be an option. Do the meta tags even matter if I use PHP only. I mean, I can't really get my head around how the token and all of that would be interpreted alongside the og: metatags if there is no javascript on the site.
Can I have BOTH php and javascript authentication? What's all that fuzz about opengraph anyway?
These are my thoughts about working with facebook, and if you'd like me to summarize this up in one question I guess it'd be:
How do I benefit from the opengraph meta tag features (tracking the users, in their timeline) when I'm only connected via PHP?
I'm confused about how the tags for specific open graph actions get interpreted like
<meta property="fb:app_id" content="xxxxxxxxxx" />
<meta property="og:type" content="myapp:read" />
and then it's supposed to post "MyName is reading lalala" or "MyName read lalala". How's the post to the server going on (if people have already authenticated via php):) ?
Unless I am misunderstanding your question, I think you are confusing how the Open Graph meta tags work. The meta tags provide external websites with exactly what they say: meta information, to be read by Facebook's "crawler". Facebook has their own web crawler that will grab certain relevant information about a webpage (for example, page title, page description, an image to associate with a webpage) so that Facebook can use that info when people "Like" or "Share" a webpage.
For example, going to https://www.facebook.com/sharer/sharer.php?u=http://example.com should illustrate how the crawler works: when someone tries to share the URL example.com on Facebook, Facebook's crawler goes to the example.com webpage and grabs relevant info, then displays it on their own page to allow you to share it with others.
The open graph tags have little or nothing to do with authenticating a user or application on Facebook's servers. They can be used totally independently of any login system that you have in place, as far as I know. All they do is provide meta information about a web page to Facebook's web crawler.
I understand your frustration with Facebook's API though - they are notoriously bad about keeping detailed, accurate information, and they change the API so frequently it's nearly impossible to keep up.
I can confirm that you're not the only one to be frustrated with the Facebook Documentation.
With that being said, i'll try to help you. As Sean said, the og graph tags have little or nothing to do with your authentication flow.
These are featured as information of what the user is doing at a certain time, like listening to a song, playing to one particular game, etc...
The Facebook's PHP SDK provides you functions to create your own objects and actions. Then you can call a $facebook->api(/...) function to indication to Facebook : My user is ACTIONS an OBJECT. Doing this, you must provide a parameter, which is the URL of the OBJECT on your Website/Application. In fact, Facebook wants you to tell him where he can finds what's this object. On a page where there's the correct meta-tags corresponding to this object ! Here are your og tags.
As you said, this will provide stories found in the timeline, or the ticker. It's those kind of things that Facebook Games use, "X is playing to Y", "Z earned the Grand Master title by playing on A", etc...
You must define those objects on your Facebook Applications Panel, and have the corresponding meta-tags on your website.
Then you just have to make the $facebook->api(/...) (or equivalent) request when this action happens on your website/application !
Everything is almost entirely explained in this tutorial : http://developers.facebook.com/docs/beta/opengraph/
Hope this will help you to find an answer.

Pulling Public Facebook Posts Into PHP Page

Last December, I set up an app for a client who wanted to pull their public facebook posts into the footer of their website.
I was using this URL to pull the message, create time and permalink and when I wrote it, all was good:
http://api.facebook.com/method/fql.query?query=SELECT%20message,%20created_time,%20permalink%20FROM%20stream%20WHERE%20source_id=138631878804%20AND%20message%3C%3E%27%27%20limit%203
Today they reported that it was no longer pulling their information. I put that url into a browser and the result is "Requires valid signature"
I've gathered from google that I need something called an access_token, also I've seen where I can use the php sdk but then I need an appId and a secret token.
At this point, I've read so many different sources that I am thoroughly confused. The FQL query above represents the full extent of my Facebook programming experience. It looks like maybe I want the Graph API, but I don't want anyone to have to sign into anything.
Can one of you guys who are more versed in the voodoo of facebook nudge me in the right direction to do this:
From PHP, pull public messages from the stream table without forcing a user to log into facebook.
Thanks!!
To pull posts from a publicly visible Page on Facebook, you can use any valid access token. For most sites managing a page, this will be a page access token retrieved via one of the page's admins authorising your app to have access to their pages, but that might be overkill for your use-case.
Probably the quickest solution is to just create a new App ID for the site, get the app access token for that App (see 'App Login' on https://developers.facebook.com/docs/authentication/ ) and then use that access token to retrieve the posts.
I found several links all from a simple Google search.
Duplicate question: https://stackoverflow.com/questions/3298836/how-you-get-access-tokens-for-facebook
http://benbiddington.wordpress.com/2010/04/23/facebook-graph-api-getting-access-tokens/
https://developers.facebook.com/docs/authentication/

Categories