Download presentation
Presentation is loading. Please wait.
Published byRalf Johnston Modified over 9 years ago
1
Facebook Query Language Dr.Kwanchai Eurviriyanukul February 2011 RMUTL
2
Facebook Query Language Overview Setup Example-Query Yourself Example-Query Your friends
3
Graph API The Graph API is the core of Facebook Platform, enabling you to read and write data to Facebook. people, photos, events People: http://graph.facebook.com/bonnKwanchai/pictu re http://graph.facebook.com/bonnKwanchai/pictu re
4
Facebook Query Language http://developers.facebook.com/docs/reference/fql/ 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.
5
First query http://developers.facebook.com/docs/reference/fql/ 1.SELECT name FROM user WHERE uid = 641805439
6
Examples 1.SELECT name FROM user WHERE uid = 641805439
7
Test your query http://developers.facebook.com/docs/referen ce/rest/fql.query http://developers.facebook.com/docs/referen ce/rest/fql.query
8
PHP programming 1. Get your Facebook API key. http://developers.facebook.com/setup/
9
Get your Facebook API key.
10
Test your Facebook API key. With exmple-1
11
With exmple-1
12
PHP programming 1. Get your Facebook API key. http://developers.facebook.com/setup/ App Name: fql App URL: http://localhost/advanceDB-2- 53/fql/ App ID: 190424107654631 App Secret: fb9efedbb146aadf3eea879903b8b7a7
13
Ex-2
14
PHP SDK https://github.com/facebook/php-sdk/
15
PHP SDK https://github.com/facebook/php-sdk/
16
PHP SDK: Run with localhost http://localhost/advanceDB-2-53/fql/examples/example.php
17
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. );
18
PHP SDK: Test Again http://localhost/advanceDB-2-53/fql/examples/example.php
19
PHP SDK: Press Login button http://localhost/advanceDB-2-53/fql/examples/example.php
20
PHP SDK: PHP 6 issue http://localhost/advanceDB-2-53/fql/examples/example.php parse_str(trim( //get_magic_quotes_gpc() 0 ? stripslashes($_COOKIE[$cooki eName])
21
PHP SDK http://localhost/advanceDB-2-53/fql/examples/example.php
22
Ex-2 select yourself
24
What is this? SELECT first_name, last_name,birthday FROM user WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2=614902533)
25
What is this? SELECT first_name, last_name,birthday FROM user WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2=614902533)
26
What is this? SELECT first_name, last_name,birthday FROM user WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2=614902533)
27
What is this? SELECT first_name, last_name,birthday FROM user WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2=614902533)
28
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=614902533)
29
Query Friends SELECT first_name, last_name,birthday FROM user WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2=614902533)
30
Query Friends: What is missing SELECT first_name, last_name,birthday FROM user WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2=614902533)
31
Query Friends: What is missing: Birth Day We need permission WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2=614902533)
32
Query Friends: What is missing: Birth Day We need permission WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2=614902533)
33
Query Friends: Birth Day We need permission WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2=614902533)
34
Query Friends: Birth Day We need permission WHERE uid IN ( SELECT uid1 FROM friend WHERE uid2=614902533)
35
The End List the uid, status_id and the corresponding status massage of specific user within last week.
36
Ex3.php
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.