Hi guys i've searched a lot here on stackoverflow but i'have not find a solution for my problem.
I'm building a (University) project , this project aims to do some operation (like sentiment analysis) on a user statuses.
I'm using Facebook PHP SDK , and after login i can get some of my Statuses with this code :
$request = new FacebookRequest(
$session,
'GET',
'/me/statuses'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
var_dump($graphObject);
Now the problem is that with this code, i get something like ~20 of my statuses, and at the very bottom of the response i got the paging links (previous or next) for get ~20 more statuses.
There is a way to get all my posts from the first? Or some trick to get that?
Thanks in Advance Nico.
Related
I am looking for a fairly simple way of obtaining pictures from Facebook. I have a client that has pictures that he uploads to Facebook quite often. He wants a way for those pictures to be populated on the website that I built for him a while ago. I thought doing it with google drive would be a fairly easy solution for him, but it has not been.
I am trying to create a simple page that grabs his folders that the images live in with the graph api, without having to do a lot or having users logged in. What is going to be the easiest way of doing this?
I tried the explorer for the api and have the following code.
<?php
$request = new FacebookRequest(
$session,
'GET graph.facebook.com',
'/me',
array(
'fields' => 'id,name,photos{album}'
)
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
?>
I for now would just like to be able to echo the elements so that I can learn how it works, after that I can refine it. What am I doing wrong?
I'm using the Facebook PHP SDK with Laravel and I need to loop through all photos in all albums and I'm struggling a little!
What I have at the minute is:
$request = new FacebookRequest(
$session,
'GET',
'/{username}/photos'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
print_r($graphObject);
this outputs JSON which I can't seem to find an easy way to loop and pull out the source for all the images. Does the SDK have some nice functions to grab the images for me?
Cheers,
Nick
I'm trying to implement Facebook payments (on canvas), what I've got so far, is that FB is calling my callback URL, I can get the payment's ID, and now I'm supposed to call Graph Api to get the details. And this is what I can't do.
Here ( https://developers.facebook.com/docs/graph-api/reference/v2.2/payment ) is an example of doing it in PHP:
$request = new FacebookRequest(
$session,
'GET',
'/{payment-id}'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
It returns NULL. They say later that:
An app access token for the app that created the payment is required.
I have no idea how to get one and then how to send it along with the above request.
Can somebody help?
You need to make the following get request:
https://graph.facebook.com/oauth/access_token?client_id={app_id}&client_secret={app_secret}&grant_type=client_credentials
I am using the following to make my requests to Facebook
$facebook->api('/feed',
array(
'access_token' => $_SESSION['fb_access_token'],
));
However, I want to get the news feed of the user.
Not to be confused: I do not want the feed of a certain user, much less of a given page.
I want the News Feed/Feed Stream the user views when accessing Facebook, one that contains the posts of your friends, etc.
How is this possible?
Make an API call to /me/home or /user_id/home where user_id is the current session user.
You are also using the old PHP SDK
/* PHP SDK v4.0.0 */
/* make the API call */
$request = new FacebookRequest(
$session,
'GET',
'/me/home'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
Reference: https://developers.facebook.com/docs/graph-api/reference/v2.2/user/home
UPDATE:
The latest Graph API doc suggests the following:
As of October 6th, 2015, this endpoint is no longer available. Please consider using the /user-id/feed edge instead.
This effectively means we cannot access the user news feed provided by Facebook but will have to rely on /user-id/feed as an alternative.
The endpoint is me/home.
https://developers.facebook.com/docs/graph-api/reference/v2.2/user/home
The posts that a person sees in their Facebook News Feed.
Getting all recent notifications including read via Graph API, call:
graph.facebook.com/USER_ID/notifications?include_read=true
So I have a friend who is a musician and has a page set up. He has asked me if there is a way of getting all the events on his Facebook Page via the Graph API and then putting them onto his website. I said I'd look into if this is even possible given that the API is now at version 2 and the PHP SDK has been bumped up to version 4.
Does anyone know how I'd do this? I already know how to make 'GET' request using the new PHP SDK, however I don't seem to be able to get the necessary fields.
Any help would be great!
Thanks!
It's given on developers.facebook.com
/* make the API call */
$request = new FacebookRequest(
$session,
'GET',
'/{page-id}/events'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
More at https://developers.facebook.com/docs/graph-api/reference/v2.0/page/events
Hope this Helps.