tags:

views:

114

answers:

1

Hi there, i query some wall data within my facebook tab. I was wondering how to filter the data (query) to show only post which are visible to a certain country.

$query = "  SELECT 
            post_id, created_time, attachment,action_links, privacy
        FROM 
            stream 
        WHERE 
            source_id = ".$page_id." 
            AND viewer_id = ".$user_id."
            AND actor_id = ".$actor_id."
        LIMIT
            50";

The Output already show Australia: But how to filter for Australia-Only.

Array (
[posts] => Array
    (
        [0] => Array
            (
                [post_id] => 123
                [viewer_id] => 123
                [source_id] => 123
                [type] => 46
                [app_id] => 
                [attribution] => 
                [actor_id] => 123
                [target_id] => 
                [message] => Only for Austria
                [attachment] => Array
                    (
                        [description] => 
                    )

                [app_data] => 
                [action_links] => 
                [comments] => Array
                    (
                        [can_remove] => 1
                        [can_post] => 1
                        [count] => 0
                        [comment_list] => 
                    )

                [likes] => Array
                    (
                        [href] => http://www.facebook.com/social_graph.php?node_id=118229678189906&class=LikeManager
                        [count] => 0
                        [sample] => 
                        [friends] => 
                        [user_likes] => 0
                        [can_like] => 1
                    )

                [privacy] => Array
                    (
                        [description] => Austria
                        [value] => CUSTOM
                        [friends] => 
                        [networks] => 
                        [allow] => 
                        [deny] => 
                    )

                [updated_time] => 1271520716
                [created_time] => 1271520716
                [tagged_ids] => 
                [is_hidden] => 0
                [filter_key] => 
                [permalink] => http://www.facebook.com/pages/
            )
+1  A: 

I think you'll have to add another filter to the query:

$query = "  SELECT 
        post_id, created_time, attachment,action_links, privacy
    FROM 
        stream 
    WHERE 
        source_id = ".$page_id." 
        AND viewer_id = ".$user_id."
        AND actor_id = ".$actor_id."
        AND privacy = ".$your_privacy_filter // Austria, in this case.
    LIMIT
        50";

Maybe the filter has to be like this:

//...
"AND privacy.description = ".$your_privacy_filter
Jorge