Get all facebook group post using FB Graph API - php

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.

Related

YouTube Analytics API: Finding unique visitors on a channel

I'm using YouTube Analytics API to find authorize a YouTube channel using OAuth2 and then trying to find the unique viewers that the channel encountered. This is the URL that I'm sending a request to:
https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel==MINE&start-date=2000-06-01&end-date=2016-04-25&metrics=uniques&access_token=XXXX
I'm using the uniques metric in the above case. However, this is what is returned as response:
Array (
[error] => Array (
[errors] => Array (
[0] => Array (
[domain] =>
global [reason] =>
badRequest [message] =>
The query is not supported.
Check the documentation at
https://developers.google.com/youtube/analytics/v1/available_reports
for a list of supported queries.
)
)
[code] =>
400 [message] =>
The query is not supported. Check the documentation a
https://developers.google.com/youtube/analytics/v1/available_reports
for a list of supported queries.
)
)
What seems to be wrong here?
A 400 response code identifies a bad request. It indicates that a request was poorly formed or contained invalid data. For example, you will receive a 400 response code if you submit a request to the wrong URL or include an unsupported or nonexistent parameter in your request.
I also found the same issue here. The solution for his problem, is that you need to specify the dimension to use the unique queries.
Dimensions are common criteria that are used to aggregate data, such as the date on which the user activity occurred or the country where the users were located.
For more information check this page.

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 Graph API Location Search Type

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/

How do you find out if a user has installed my app?

I need to work out if a user has my app installed so I can display a slighlty different page. How do you do this?
Ideally you'd want to capture their Facebook user ID in your own database when they originally install your app. When they come back, you can compare the current users Facebook user ID with your database to see if you find any matches.
If you don't have a database, you can always check on a user permissions using the Graph API. You can find the code here: http://developers.facebook.com/blog/post/495
This will give you back an array that looks something like this:
Array ( [data] => Array ( [0] => Array ( [installed] => 1 [bookmarked] => 1 ) ) )
In this case, the user has it installed and has bookmarked it. Now that you know that, you can display a slightly different page.
You do this by using the FB JavaScript API and querying if the user is logged in. If it is (to you) it will have your app installed.

Facebook: Get user's friends' time-zones

I would like my canvas application to obtain time-zones of my user's friends.
I tried doing it with the Graph API but all I can get is their names, locales and a few more (even when using the access_token).
When using FQL the timezone field is always empty.
Is there a way to achieve this?
If so, could you please point me in the right direction?
Cheers
I guess this is not possible, only the following fields were retrieved when calling $this->facebook->api("/friend_ID");:
Array
(
[id] =>
[name] =>
[first_name] =>
[last_name] =>
[link] =>
[gender] =>
[locale] =>
[updated_time] =>
)
Now in the documentation, the above fields are the fields marked Publicly available, in time the timezone field is Available to everyone on Facebook which sounds like the same but apparently it's not, anyway I've found this interesting article for a moderator on the facebook forums (not a developer!!)
Also tried the old rest lib, first get a list of your friends from the console and then add your ID and put them in the test console of the users.getinfo method, UIDs looks like your_id,friend_id,friend_id,friend_id,friend_id and fields timezone you'll only get your timezone.

Categories