Going deeper into facebook's graph: collecting friends available data - php

I am building an PHP website using Facebook Graph API's and I can only read and collect very basic data.
I managed to collect the one-line informations from my profile:
Ex:
$user_profile['hometown'];
$user_profile['bio'];
$user_profile['name'];
$user_profile['id'];
printscreen 1: http://postimg.org/image/fsj6w4dtz/
First of all, I want to collect for the current user logged in, the education data for example:
*how should I collect this data, because $user_profile['education']; it is not working? What do I have to do if I want to collect informations about the users education (such as school, year, class-mates, type?)
printscreen 2:
My main focus is finding a way to get for the current user loggedin, all of his friends data (such as name, events, bio, birthday, everything they let me to :d)
*I've googled and read part of the facebook API's docs but I dont really understand how to do this. I know this is possible, because I have tested with this tool: developers.facebook.com/tools/explorer/?
printscreen 3:
** below is a image of trying to read the friends's infos, but for sure its wrong (anyway it doesnt work): postimg.org/image/4dg8khj77/

I think you are struggling while accessing the object that the API returns. Facebook PHP API returns the decoded JSON object and therefore you must understand how to access data in a JSON decoded PHP object. Have a look at this thread to see how you can do that.
Therefore, in this case, you can simply access the deeper levels of a decoded JSON object by doing something as: $user_profile->education->school->name

Related

Combine Facebook and Twitter Searches

I am making search requests to both Facebook and Twitter using an iPhone application, my issue is I require to combine the searches into a single view, so to go about this I intend to make a request to an individual script on my server, which will then make the requests to both Facebook and Twitter, decode the JSON results, combine them, order by date and then output once again in JSON. This JSON will be fetched by my iPhone application, decoded and placed into a table view.
Whilst I have the client side part sorted, and am capable of making requests in PHP to obtain Facebook and Twitter search results, I have no idea how to combine them and order by date, given that the JSON keys/entities for Facebook and Twitter are different. They don't both use the same key for date, for example. How would I go about doing this?
Some code examples would be great.
Is there something preventing you from creating your own data object or storage method with a way to parse a Facebook or Twitter result into it? If both results have different keys for the date as you say, you would just translate it into something you can parse.

Take the likes from users of my app and file them into csv

I need to be able to consolidate all the likes from users that use my Facebook app into an Excel or .csv file. I can have the user authenticate within my Facebook app, but is there a way to see the likes for all users of an app using Open Graph or some other Facebook tool? I'm certain that someone else must have had this problem, and I'm hoping that one of you can help me out!
I've been trying to run FQL queries to bring up likes, but don't have any experience with PHP so it has been miserable so far. Any ideas?
There's no way to retrieve a list of users of your app - you'll need to manually build that as users authorise the app see this question for more information
Assuming you have permission to access a user's likes connection - access /USER_ID/likes and parse the response, saving it to a file in accordance with whatever language you're using's syntax (google is your friend here)
Note that your use of the data is subject to Facebook's policies and user's consent in accordance with your privacy policy and sharing it with third parties may be illegal (i am not a lawyer, this is not official advice, etc etc)
Here is the problem with that the application type does not have a like connection. Application Object GraphAPI This is inconvenient when you are looking to gather data on the users that like it.
OR were you talking about the likes endpoint of the user object? That you can gather but I dont think it is what you are looking for. It is shown here Graph Explorer Example - user's likes

Problem using Linkedin API

I am using linkedin api to get info about the logged in user. I am able to get firstname and lastname, picture etc., It works fine. But I am not able to get recommendations. I am able to get number of recommenders using num-recommenders.
I am not getting **recommendations-received** according to http://developer.linkedin.com/docs/DOC-1061. I printed out the json response no recommendations Object for the user.
I appreciate your help.
For unfortunate reasons, if you want to get access to that field, you need to replace IN.API.Profile().fields("firstName","lastName","recommendationsReceived") with IN.API.Raw("/people/~:(first-name,last-name,recommendations-received)").
This is a good thread to read on the LinkedIn Developer forums: http://developer.linkedin.com/message/8805

Getting the user_id through Foursquare Api V2

I'm working on a foursquare integration for a social good website, and I have everything working as I want it to, however I want to retrieve and store users foursquare user_id's so others can search for their friend. I've been searching all day, but I can't seem to find an end point, am I missing something? Or does this has to be done through user search? What is then best to use, as I have their email, and full name.
I am using jmathai's foursquare-async php libary. I think it should be easy but I just can't figure it out.
I've found the solution. To get an users' details you should use the end point "users/self". I had tried this before but got an error message. I think that was related to something else now.
After authenticating two lines are simply enough:
<?php
$fsObj->get("/users/self");
print_r($creds->response);
?php>
This gives an json array containing all relevant information on the user, including last checkins, name, and id. 'self' can here also be replaced by any user id you're authorized for on that moment.
For more information I'd recommend to visit Foursquare Api website

Facebook Graph API : Some requests return an ampty data array

I hope someone wil be able to help to resolve my problem.
We can't say Facebook's forums are very useful for developers...
This is my problem.
On two different applications, I execute requests with Graph API.
For one of both, I make a friends request to invite user's friends to use application.
For the second application, I use Facebook Places to retrieve all informations about a location.
These two codes are simples functionnalities tests.
Before excute a request with Graph API, I ask to user to give me necessaries authorizations.
But results are, often, an empty JSON "data" array...
Before posting here, I search some solutions on internet.
Some people say application hasn't necessaries rights. Others user must like application page to retrieve informations correctly...
I tried these solutions... whithout concluant result.
For example, talking about my Facebook Place based application.
It asks user_checkins and friends_checkins rights.
Goal is to retrieve, for a given location, datas from users who're tagged there.
But I have an empty data array as return.
I tried my code in different ways, with PHP SDK, Javscript SDK and FQL. Same result.
Thanks :)
Sorry for my english. I'm a french developper ;)
For this - "Goal is to retrieve, for a given location, datas from users who're tagged there." Refer to https://developers.facebook.com/docs/reference/api/page/ and you will see that you can only get the checkin information for the current user or friend of the current user. In the case of a friend you will only get that information if the friend has allowed other apps to see this. So to test that you get data you should check in to a place (page), find the place's id, then make a query to https://graph.facebook.com/PAGE_ID/checkins with an access token that has user_checkins permission.
Also, here is a tool that you may find useful when debugging your API calls and permissions - https://developers.facebook.com/tools/explorer

Categories