Here’s the PHP:

Exception Thrown: FacebookRestClientException

Code: 100, Message: Invalid parameter

You can also try FQL in this box. This is a nice place to start inserting different FQL queries to see what is getting returned in different formats.

Here is a quick sample of FQL that queries Facebook for a link to my profile picture:

SELECT pic

FROM user

WHERE uid = 7608123

You’ll notice the response format returns a single field in the <fql_query_response> element:

<?xml version="1.0" encoding="UTF-8"?>

<fql_query_response xmlns=http://api.facebook.com/1.0/

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" list="true">

<user>

<pic>http://profile.ak.facebook.com/profile5/1622/61/s7608007_3215.jpg</pic>

</user>

</fql_query_response>

Or, if you prefer to get your responses in JSON, here’s the code:

[{"pic":"http:\/\/profile.ak.facebook.com\/profile5\/1622\/61\/s7608007_3215.jpg"}]

For PHP, here’s the code:

Array

(

[0] => Array

(

[pic] =>

http://profile.ak.facebook.com/profile5/1622/61/s7608007_3215.jpg

)

)
These are all the responses from the same query, just in different response formats. What you’ll notice is that each of the formats returns the information in slightly different ways. The XML format is by far the most verbose and, depending on your environment, is something you might want to take into consideration as your calls to the Facebook platform become more complex. Let’s look at another FQL query:

SELECT first_name, last_name, hometown_location.state, status

FROM user

WHERE uid = 7608007

This query will return to you my first and last name, my hometown state, and the status message I set on my home page. This is a basic query that returns a rather straightforward structure.

0 comments