Problem access graph api with some facebook page id/username - facebook

I have successfully made an facebook application which shows real time data from facebook graph api with no authentication. The method i have used is something the simple connection to the graph api because i only need the basic info for it.
$url = 'http://graph.facebook.com/'.$pagename;
// for id
$url = 'http://graph.facebook.com/'.$page_id;
$pageinfo = json_decode(file_get_contents($url));
This methord works fine but not for some pages in facebook. My client has send those pages url to me. From my pc but can't access those page (facebook redirects me to the homepage). Also i have tried to access the graph via those page username and id. Its just returning false.
Here are those pages. Note that not all pages but a few has this problem:
https://www.facebook.com/MontanaDaleCarnegie
https://www.facebook.com/pages/The-Painted-Swan-Online-Marketing/223492000998546
I can't find the issue why these pages aren't accessible. Is there any settings in the page settings page that make the page nonpublic or inaccessible via graph api? The client saying that he can access these pages.
I need your experience an input to overcome this situation. Thanks!

Apparently if any page has privacy setting restricted the page info can't be access in public.
There is couple of cases:
If the page is restricted to any country.
If the page has any age restriction. Selected anything other then Anyone (13+)
You might find it helpfull http://bugs.developers.facebook.net/show_bug.cgi?id=18162 Check comment #3.

I tried to take a look at your two examples and both take me back to the home screen. This certainly means that those pages are not publicly available.
Is there any settings in the page settings page that make the page
nonpublic or inaccessible via graph api?
Yes: In the page settings under "manage permissions" there is a checkbox for "page visibility":
Only admins can see this page
If this is checkbox is selected, neither a user on facebook nor the graph api have access to it. The only possibility would be (but I'm not sure) to use an offline access token from one of the admins.

Related

Facebook API - getting events from restricted pages

I want to make an events calendar using Facebook API. I have an array with page URLs I want to scan and take its events. The problem is, I am using an App Access Token and I can't obtain events from pages with restricted age (alcohol pages etc.). Is there any way I can obtain those events?
There is no way to access restricted Pages with an App Token. You have to use a User Token of a User who can access the Page, or a Page Token of that Page. There is no other way, or the restriction would be pointless.
Go to the advanced settings of your applications page on developers.facebook.com. e.g. for me it would be https://developers.facebook.com/apps//settings/advanced/. And set app restrictions for 'references alchohol' to yes, similar for age.
Screenshot of setting attached

Facebook: How to post on own page using graph api without login

I own a blog like website, and as part of promotions I have a corresponding facebook page. My website contents are dynamic & when it gets updated(through a bot), I want the facebook page also to be updated by an automated post/publish from the bot which shows up the updates to the page viewers.
I could create a facebook page, and my bot programme which updates the web content is also able to publish the content on my facebook page using graph apis. But the posts are not publicly visible(Visible to only me/admin).
I could learn that it could be because my app through which my bot program is publishing to my facebook page is not public.
App->Status & Review, Status (Tab)
(Do you want to make this app and all its live features available to the general public?).
To make the app public, there is a review process which checks the facebook login button used in the website but my posts are through a backend bot and not through user action. My website is like a blog without user authentication so can't think of adding a login there.
Is it possible without having user login on the page? Also, If I post using twitter apis and link/configure my twitter account to my facebook page, it works.I guess this is not a new problem and many brands have automated it already, so need to understand how.
Am I missing something?
Apologies: I have checked previous posts on the same topic, but couldn't find relevant answers for the current Facebook version & policies.
Without the Login Review process, your posts can not be visible to the public.
To get it working, just send your page management tool (with the login dialog) for the review. Once they review it and accepted, you may change the flow a bit eg: skip the login part and allow auto posting.

When should I use fb:admins and fb:appid?

I have a client who already has a Facebook page associated with their own website. I finally convinced them to integrate open graph tags into their pages, since when anyone clicked the Facebook Like button on their website, it looked awful on Facebook (since it chose whatever images and content it wanted).
I have admin access to their Facebook page, however, they are using the fb:appid tag instead of fb:admins on their website, so I can't see any of the insights on Facebook.
So I need to be made an admin of their Facebook application as well, in order to see the insights?
I've read dozens of forums and posts about this, including Facebook's own Open Graph documentation and I still don't REALLY understand the difference between fb:admins and fb:appid. As far as I can tell, fb:appid is more for developer/programming access, whereas fb:admins is for those who just want reports and insights for page activity.
In what circumstances would I want to use fb:appid over fb:admins?
EDIT : Let me clarify. I can already view insights for the company's Facebook page. What I want to do, is see the insights for users who have clicked the Like button on the website.
fb:app_id is the most flexible one to use.
It allows anyone who's listed in the app settings as an admin, developer or insights user to see their domain or app insights. This means as people join or leave a company, they update their app in one place, and access to things like insights changes too.
fb:admins is for User IDs, and once they've been associated with a URL or domain, they remain connected with that domain until their removed from the root HTML document.
fb:page_id works in the same way as fb:app_id in that access to insights is controlled by the list of people who are admins of that page.
As app_ids are becoming more and more important as you integrate with the deeper bits of the Facebook platform (use connect, comments etc) I STRONGLY suggest you use fb:app_id, claim your domain using this, and manage access to insights via your app's settings.

Can a FB App "via appName" link to our Fan Page? - What do you do?

I created a FB App to facilitate FB Connect authentication on my website.
Users can share content from my site to Facebook via the same FB app.
We also created a FB Fan Page to grow our community reach.
However a FB App is a separate entity than a Fan Page, whatever content is shared via our website to FB the App link sends the users to an empty App page while all the fuzz is in our Fan page.
I did an extensive research for this issue and only came up with this useful post here in stackoverflow: "Fan page vs Application Page".
Ideally i'd want the App link ("... via appName") on every shared item to point to our fan page.
I need to know if this is an issue that FB needs to address, if i am missing something and what do you do to solve this situation
Some apps are able to do this :
http://mediafeedia.com/pro/
http://www.postplanner.com/white-label-facebook-app/
I also would be interested to know how they do this.
I've checked all app settings...
No, the App attribution on posts made via the API returns the user to that app's profile page - you'd need to have information there directing them back to your brand page if that's where you want them to go after they end up there.
I think in most cases people would click the name of the page or one of the links in the post rather than that small link at the bottom, no?

Hide a Facebook tab based on user's location

We're developing a Canvas app that will have a tab when implemented on the fan page. The Tab will have the like gate. What we want to do, is restrict access based on location. So, Facebook users outside of the US wouldn't see the tab when the go the fan page.
This blog posts speaks to showing users different content based on location (http://developers.facebook.com/blog/post/394), but i don't want them to see the tab at all.
Any thoughts?
To set demographic restrictions (i.e., location, age, etc.) issue an HTTP POST with an app access token to
https://graph.facebook.com/APP_ID?restrictions={“RESTRICTION_TYPE:VALUE”, …}
ie:
https://graph.facebook.com/APP_ID?restrictions={"location":"US"}
Users who do not pass the restrictions will not see the tab.
More information at: Facebook Developer Blog & Graph API: Application.
When an application is accessed as a Tab on a Page (iFrame) Facebook Passes a signed request (http://developers.facebook.com/docs/authentication/signed_request). You would be able to use that data to get the user's location. However, it might need further authentication to get that information.
Please refer to this question for a hack to find the user location through their IP:
Getting user location on Facebook page tab
Anyway, as far as I know, you cannot remove the application all together, you have to show up 'some content' for the users who load the tab. I suggest that if you want to restrict page content to use the country restriction for the entire page. However, it might be impractical for your use case.