Facebook Query Language Dr.Kwanchai Eurviriyanukul February 2011 RMUTL
Facebook Query Language Overview Setup Example-Query Yourself Example-Query Your friends
Graph API The Graph API is the core of Facebook Platform, enabling you to read and write data to Facebook. people, photos, events People: re re
Facebook Query Language Query the data exposed by the Graph API. SELECT [fields] FROM [table] WHERE [conditions] the FQL FROM clause can contain only a single table. Use the IN keyword in SELECT or WHERE clauses to do subqueries, Can query only indexable attributes from tables. Support simple math, basic boolean operators, AND or NOT logical operators, and ORDER BY and LIMIT clauses.
First query 1.SELECT name FROM user WHERE uid =
Examples 1.SELECT name FROM user WHERE uid =
Test your query ce/rest/fql.query ce/rest/fql.query
PHP programming 1. Get your Facebook API key.
Get your Facebook API key.
Test your Facebook API key. With exmple-1
With exmple-1
PHP programming 1. Get your Facebook API key. App Name: fql App URL: 53/fql/ App ID: App Secret: fb9efedbb146aadf3eea879903b8b7a7
Ex-2
PHP SDK
PHP SDK
PHP SDK: Run with localhost
Modify facebook.php 1. public static $CURL_OPTS = array( 2. CURLOPT_CONNECTTIMEOUT => 10, 3. CURLOPT_RETURNTRANSFER => true, 4. CURLOPT_TIMEOUT => 60, 5. CURLOPT_USERAGENT => 'facebook-php- 2.0', 6. CURLOPT_SSL_VERIFYPEER => false, 7. CURLOPT_SSL_VERIFYHOST => 2, 8. );
PHP SDK: Test Again
PHP SDK: Press Login button
PHP SDK: PHP 6 issue parse_str(trim( //get_magic_quotes_gpc() 0 ? stripslashes($_COOKIE[$cooki eName])
PHP SDK
Ex-2 select yourself
What is this? SELECT first_name, last_name,birthday FROM user WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2= )
What is this? SELECT first_name, last_name,birthday FROM user WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2= )
What is this? SELECT first_name, last_name,birthday FROM user WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2= )
What is this? SELECT first_name, last_name,birthday FROM user WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2= )
What is this? => Don’t forget to login SELECT first_name, last_name,birthday FROM user WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2= )
Query Friends SELECT first_name, last_name,birthday FROM user WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2= )
Query Friends: What is missing SELECT first_name, last_name,birthday FROM user WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2= )
Query Friends: What is missing: Birth Day We need permission WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2= )
Query Friends: What is missing: Birth Day We need permission WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2= )
Query Friends: Birth Day We need permission WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2= )
Query Friends: Birth Day We need permission WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2= )
The End List the uid, status_id and the corresponding status massage of specific user within last week.
Ex3.php