Jump to content

Facebook friends!


chokk
 Share

Recommended Posts

Hey all,One of the small annoyances in life is when you realize you've "lost" a friend on Facebook, but it isn't immediately obvious to you, who. The person either disabled his/her Facebook profile or deleted you as a friend.What I would like to do, is have PHP search through the 'source code' of the friends page listed belowwww.facebook.com/profile.php?id=xxxxxxxxx&sk=friends&v=friendsand record all friend names to a table in a database. This would happen everyday and each new day the script would compare the old list to the newly recorded list. When someone either deletes you or disables his/her account, the script will inform you that you're missing a friend and tell you which friend is missing.Is this feasible?

Edited by chokk
Link to comment
Share on other sites

Why?

<div class=\"fsl fwb fcb\"><a href=\"http:\/\/www.facebook.com\/profile.php?id=xxxxxxxxxxxxxxx\">Friend Name<\/a><\/div>

That's the markup "template" for a friend.Using regex I'm sure you can extract friend names. What I'm not sure about is how you can make PHP read an external file and extract data from it?

Link to comment
Share on other sites

you could use cURL or the HTTP extension. The API is probably a lot easier though, and it will probably return it all in a nice format, i.e. JSON or XML.

Edited by thescientist
Link to comment
Share on other sites

That's the markup "template" for a friend.
Yeah, that's what it is today. Is it going to be the same next week? Next month? Next year? How many times do you want to update your code if they decide to change the markup? Doesn't it make sense to use their service that they specifically provide to get this information in a reliable manner?
What I'm not sure about is how you can make PHP read an external file and extract data from it?
You can use file_get_contents if that's what you really want to do.
Link to comment
Share on other sites

The problem is that I'm not all that advanced yet. I've read some of the API documentation but it looks overwhelmingly difficult to understand.I get the basic principles of an API, but I don't know how to apply it. :)

Link to comment
Share on other sites

The reference for the graph API is here:http://developers.facebook.com/docs/reference/api/The "graph" is the network of people and their connections to each other. One of the objects there is a "FriendList", which contains a list of the person's friends. In order to use that you would write an actual Facebook application that people could install to their profile, and they would give the application permission to access their friend list. Then your application could send that data to your own database and you could run your analytics there, or even respond with updates so that people could see right on their profile who the added or missing people are. Another way would be to have people enter their Facebook information on your site, and you go out and get the data, and they see everything on your site instead of their Facebook profile. It's possible to do all of that with the API.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...