Michael B
Michael B

Reputation: 145

how to get Facebook page using FQL, given a company's website?

I have a list companies and their websites (for example: http://www.target.com). I'd like to programatically determine their pages on Facebook (http://www.facebook.com/target). How can I use FQL to get the Facebook username, page_id, or actual Facebook page_url from a company's website?

I've searched for a query or combination of queries that can get me there, but no avail. The obvious query

SELECT page_id, page_url FROM page WHERE website = 'http://www.target.com'

fails because website is not an indexed field.

Upvotes: 0

Views: 637

Answers (2)

Mohammed Alaghbari
Mohammed Alaghbari

Reputation: 439

This FQL will start getting any website containing the string passed toCONTAINS function. After getting a list of websites, the condition website = "www.google.com" will filter the list of websites and get exactly the page info required.

This is the FQL you need to execute:

Select page_id,page_url,website from page where website = "www.google.com" 
And username in (select username,website from page where contains("google.com"))

Note : Use the domain and domain TLD only like google.com or only google inside CONTAINS function

But if you executed this FQL

select page_id,page_url,website from page where contains("www.google.com")

You will notice that you will get a big list of output that don't meet the search criteria..

Regards,,,

Upvotes: 1

cpilko
cpilko

Reputation: 11852

Facebook limits what is searchable. I believe the best you can do is to search for "Target.com" in all Facebook pages.

SELECT page_id, page_url FROM page WHERE CONTAINS('target.com')

Upvotes: 1

Related Questions