Retrieving messages from status table in FQL using PHP SDK-Collection of common programming errors

I am developing a php script for retrieving messages from a page (not user) in facebook. I have access to that page (it is mine) so if I must to modify something in config, I can.

I tried the FQL query in graph api webpage from Facebook and it works. I get the file with all messages.

But whenever I try it in my php script, it fails. I am trying it in a localhost server and calling the script : “localhost/testServer/phpScript.php” I don’t know if I have to add a parameter.

I have checked many examples and tutorials and all are similar but in my case, they don’t work.

I always get an exception with this message:

Fatal error: Uncaught Exception: 100: Requires user session thrown in C:\xampp\htdocs\testServer\base_facebook.php on line 1271

If I surround it in try/catch and print what I get, it tells it is an exception with getType() and an array with getResult().

My code is quite simple:

I just deleted my appId, secret and access_token.

I read something about read_stream permissions using status table. But adding access_token and ext_perm tags has no effect. I leave the uid of the webpage because it is public so you can test the code on your own.

If I can’t do this query with php fql, I have no problem in using normal api if I can get the same result.

I am expending many days doing this script and I am completely lost with the problem.

Originally posted 2013-11-19 13:16:55.