Facebook Graph API Location Search Type - php

Hi and thank you in advance,
I am currently trying to send a search request to Facebook Graph Api in PHP, and each time i send a request to the API it returns an empty array.
Sending my request to the Graph Api using the exemple on the developer page of facebook located here
My parameters are the following.
Param
(
[access_token] => "this is a valide access token that i removed to posted in the forum.",
[type] => location,
[center] => 45.33,36.210,
[distance] => 2000
)
and the path of the request is the following : https://graph.facebook.com/search
with the Get method.
But my result is constantly the same, its an empty array.
Is this feature broken, not in service or am i sending the lat long in the wrong format.

Facebook places restrictions on retrieving posts that specify locations. You can only return results for your query if:
you or a friend authored the post
you or a friend were tagged in the post.
See here for more details: https://developers.facebook.com/docs/reference/fql/location_post/

Related

Getting twitch channel feed forbidden

As per the API: https://github.com/justintv/Twitch-API/blob/master/v3_resources/channel_feed.md#get-feedchannelposts
I have tried using PHP and cUrl to get the latest channel feed comments. This is the URL I am polling:
https://api.twitch.tv/kraken/feed/:username/posts
Obviously with :username as my actual username. I am also passing:
"oauth_token" => "[MY OAUTH TOKEN]"
I know that this procedure normally works because I am using it to get normal info about the channel and followers info. Though trying it with the feed posts I get this message back (after JSON decoding it):
Array
(
[error] => Forbidden
[status] => 403
[message] => Channel feed is disabled
)
When I set up the authorization for the account using oauth I included the following scope for allows:
user_read user_blocks_edit user_blocks_read user_follows_edit channel_read channel_editor channel_commercial channel_stream channel_subscriptions user_subscriptions channel_check_subscription chat_login channel_feed_read channel_feed_edit
As far as I know that is everything so not sure why it's coming up as forbidden, and as I mentioned I am using other parts of the API so not sure whats wrong here... Any ideas or help is greatly appreciated :)
I am by no means an expert on twitch's API but I'll give it a shot. Looking through their github documentation it shows 3 ways of sending access token for authentication.
Is it possible you're sending the token in the HTTP body? It explicitly states that this won't work with GET and DELETE methods, which could be giving you an error when trying to GET channel feed posts. Hope this helps.
EDIT: Yousimply don't have channel feed enabled on your account. It's currently opt-in because it's in beta. See: http://help.twitch.tv/customer/portal/articles/2377877-how-to-use-channel-feed

Get all facebook group post using FB Graph API

I want to get all facebook group post using FB Graph API.
I searched , googled, seen documentation for graph api, asked to so many persons, all are saying it is possible
Also i'm providing link from stackoverflow which i referred and tried
How to get all posts of a group via facebook graph api
But as you can see the post is very much old (from 2013)
When i tried to send request using CURL, at that time i'm not getting any error not any data
When i tried below code
$publish = $facebook-api('https://graph.facebook.com/v2.3/'.$group_id.'/feed/?access_token='.$params['access_token']);
at least i'm getting something in response
Array
(
[og_object] => Array
(
[id] => 859455820800214
[type] => website
[updated_time] => 2015-06-04T12:18:15+0000
[url] => https://graph.facebook.com/v2.3/659988617465253/feed/
)
[share] => Array
(
[comment_count] => 0
[share_count] => 0
)
[id] => https://graph.facebook.com/v2.3/659988617465253/feed/
)
So i just wanted to know that is it really possible at this moment?
And one good thing is that when i'm trying it from Graph API Explorer, i'm getting the data properly.
So where i'm wrong ?
Any little help would be greatly accepted
Why don't you just use the Facebook PHP SDK?
https://developers.facebook.com/docs/reference/php/4.0.0
You can get the group's feed via /{group_id}/feed, as described at
https://developers.facebook.com/docs/graph-api/reference/v2.3/group/feed#read
Make sure your Access Token is of the right type and contains the right permissions.

Missing elements in Feed data returned by Facebook Graph API

I am using the Graph API to retrieve Feed data from a number of public Facebook pages and a public Facebook group. The array of data returned by the API occasionally contains Posts with missing data which is visible when the Posts are viewed in Facebook.
I wonder if anyone can shed light on this, and explain whether it is just a glitch in the Graph API, or some sort of permissions issue?
The problem appears to occur with data from the public Facebook Group, and affects Posts which are of [type]=Status under certain conditions. A couple of examples:
Posts of [type]=Status where the user has included a link: In this scenario, the Post [message] is present, but the [link] and [picture] elements are missing. The data returned includes the following data - "[caption] => Attachment UnavailableThis attachment may have been removed or the person who shared it may not have permission to share it with you".
All the [comments] and [likes] data is present and correct.
Posts of [type]=Status where the user has posted a photo: In this scenario, the [message] and [picture] elements are missing, but the [comments] and [likes] data is present.
For Posts of [type]=Status with just a simple [message] (no photo or link) the Post data all seems to be returned correctly by the API. Posts of [type]=Link or [type]=Photo are also returned correctly. I don't seem to see any of these problems when retrieving data from the Facebook Pages.
I am using the Facebook PHP SDK to retrieve the data. Currently I am using SDK 4, but I experienced the same problem with the previous version of the PHP SDK. I am making a simple GET call, with an App Session constructed using my App ID and App Secret (no access token).
I'm guessing there is something subtle going on with permissions here (as indicated by the caption message for the first scenario above) but the Group is public, and the missing data can be viewed on the Group page by any Facebook user.
This question appears to be related but I have not been able to track down any information about my specific problems, so any suggestions gratefully received!

Twitter account/verify_credentials returning 34 error code

I found a whole bunch of related questions here, but since Twitter had made a lot of changes in its API, most of them are outdated (+ nothing actually solved my problem).
So My website is a semi social network (with posts, likes comments etc). The user has the option to post to twitter and facebook through my site. Everything is working just fine, posts are finding their way to both FB and TW.
I'm using Twitter oauth php library, posting is done like so:
$response = $connection->post("statuses/update", array('status' => "Tweet"));
but when if I want to verify user's credentials like so:
$response = $connection->get("account/verify_credentials.json");
I get:
[0] => stdClass Object
(
[message] => Sorry, that page does not exist
[code] => 34
)
I don't think the problem is in the authentication process nor in the app settings, for I was able to post a tweet but got that same error, both using the same access token (and obviously the same app).
apparently you get this 34 error for a variety of cases, the documentations is so ambiguous about it.
So any troubleshooting techniques are appreciated.
Just use
$response = $connection->get("account/verify_credentials"); // Remove the .json

facebook access token for offline_access - PHP

I'm trying to get the status from facebook users, who connect to my app with offline_access and read_stream permissions.
All the processes will use subscription to get notification about new feeds, and then take access to status of the user, who changed it.
The code for subscription works great, I get all info as it should be, but the problem starts with second part - every time I try to access user status via
$objFacebook->api('/'USER_ID'/statuses?access_token=TOKEN', 'get', $params);
I get the exception:
An access token is required to request this resource
I tried to set access_token which I got when connected to my website via facebook login, also tried to set the whole session in similar way as it is done here:
Array
(
[access_token] => ...
[base_domain] => ...
[expires] => 0
[secret] => ...
[session_key] => ...
[sig] => ...
[uid] => ...
)
but it didn't help. On the other side, when I copied my access_token generated via facebook developers (http://developers.facebook.com/docs/reference/api/user/) it works correctly, so it looks like my app generates an incorrect access token.
Do you have any idea where the problem can be?
To connect I use facebook-php-2.0 library.
You should upgrade to version 3 of the PHP SDK. We made some changes to the cookie format and other things you can read about here. Version 2 will stop working on September 1st, so you'll need to upgrade soon anyways. Once you've done that, things should work for you.
P.S. You probably will want to use the "/posts" connection rather than than the "/statuses" connection of the User object as it will also give you any posts the user made that include attachments. The "/statuses" connection will only return text-only posts the user made. We'll update the documentation to clarify that.

Categories