Facebook: How to get Object id from url

I am trying to Implement Facebook comments api(See this question if you got time), I need to get an Object id, all what I have is Object URL. If I will use Facebook debug, they are giving me some thing like this: Graph API: http://graph.facebook.com/451006711598242

I believe that 451006711598242 is my id. I been trying to do the fallow calls: https://graph.facebook.com/comments?id={myUrl} but it's not working. Any ideas what I need to do?

Answers


Try this to return the object_id:

$object_url = 'http://google.com';
$url = 'SELECT url, id, type, site FROM object_url WHERE url = "'.$object_url.'"';
$fql_query_url = 'https://graph.facebook.com/fql?q='.urlencode($url);
$fql_query_result = file_get_contents($fql_query_url);
$fql_query_obj = json_decode($fql_query_result, true);  

$object_id = $fql_query_obj['data'][0]['id'];

Need Your Help

Get custom HTTP header (Cookie) using SOAP web service client in Netbeans

java web-services cookies soap netbeans

I am using the standard web service client in Netbeans. The SOAP server includes a Cookie as a HTTP header. How do I access this header/cookie from the client code?

WinAPI CreateProcess and quoting of arguments

c++ c winapi

CreateProcess has 3 string arguments: lpApplicationName, lpCommandLine, lpCurrentDirectory.