Reputation: 57
I'm wondering how to retrieve the information that the Open Graph Debugger shows when you enter a URL.
Here's an example: I have a page that has all the right og meta tags, the top looks like this:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta property="og:url" content="http://www.freefunder.com/campaign/Short-Film-Revenge-Inc/" />
<meta property="og:type" content="Website" />
<meta property="og:title" content="Short Film: "Revenge, Inc."" />
<meta property="og:description" content=""Revenge, Inc." is the first short film for the Karmalicity Movie Project. A feel-good story with a positive message." />
<meta property="og:image" content="http://www.freefunder.com/images/campaigns/2094_main.jpg" />
<meta property="fb:app_id" content="346433602097524" />
When I look it up in the Open Graph Debugger, it gives me Code 206 and no errors, and at the bottom it will give me the URL to look this up with the Graph API, which is: https://graph.facebook.com/103335396527655
The problem I'm having is I need to be able to determine the Facebook ID (103335396527655) within my code, and not need to go to the debugger every time. If I go to:
http://graph.facebook.com/?ids=http://www.freefunder.com/campaign/Short-Film-Revenge-Inc/
It doesn't return the same information (and doesn't include the ID) as if I go to the Graph API URL provided by the debugger.
Is there any way, given a specific URL, to look up the right Facebook ID for it? This could be with the Graph API, FQL, the PHP SDK, whatever! I just need to be able to enter a URL and get the Facebook ID for it..
Thanks!
Upvotes: 1
Views: 1014
Reputation: 3212
First off, just because the page has a Like button and OG tags doesn't mean that the page has ever been scraped by the FB Crawler. If the page has never been 'Liked', 'Shared', or been part of an Open Graph action, Facebook has no idea it exists and therefore there is no information about it at graph.facebook.com
Second, there is no guarantee that same URL will always be given the same Graph ID. I've tried to do a sort of URL -> ID mapping thing (in order to check if a certain user has liked a certain page) in the past and the same exact URL can be related to any number of different IDs. The only reliable result would be with Facebook Pages and User profiles.
So, what you need to is use something like phpQuery and just go look for whatever tags you want to make sure exist on the user's page.
Upvotes: 1