As you know, Facebook does not let you see who removes you from his/her friends. Once there was a new application which recorded this information, but as it was against Facebook’s terms of use, the application was gone in a minute.

The technology, however, is there! If you know how to code in Facebook APIs, it is a pretty straightforward process. I will show you how to do it. And if you have a server space in this beautiful world, then you have all the means to see who deletes you! I warn you though, if you care too much about people, this might get painful to see as people dump you!! There is a reason Facebook bans such applications, as it has a ‘like’ button, but dislike button is nowhere to be found.

let’s get started. Go to the developers application, click here. Click on “setup new application”. 1-choose an application name, 2-enter Captcha(note that you can enter one char wrong, but it still accepts you).

On the coming pane, click on website. enter web url and web site domain. For web url, enter the address your php file will reside. like http://www.******.it/. For site domain enter like ******.it.

Now, you need to write a script that asks for 1-friend, 2-offline access permissions. Here is that script

<?php   require './facebook.php';
// Create our Application instance.
global $facebook;
$facebook = new Facebook(
'appId'  =--> '1****7',
'secret' => '9***4',
'cookie' => false));

# Lets set up the permissions we need

$par['req_perms'] = "user_about_me,read_stream,offline_access";

$loginUrl = $facebook->getLoginUrl($par);

$session = $facebook->getSession();

if ( is_null($session) ) {
	#go to permissions page
    	header( "Location: $loginUrl" );
else {

put this script to your server, i.e. name it d.php and put at http://www.******.it/. Now go to http://www.******.it/d.php with your browser. Once it loads, it will open a Facebook permissions window.

click allow, and look at the address bar. There you will see the access token. Now copy and save it. We will use that access token later.

Now, it is time to write the script that does the actual work. This script will create the table, and use two dates. The first date shows the day you became friends with someone. If you are still friends, the end date will be 0000-00-00 00:00:00. If someone deletes you, the end date will be set. Remember the access token? we will use it here. Save this file as crongetfriends.php

$db_server = "localhost";
$db_username = "cuneyt";
$db_password = "your_pass";
$db_name = "database_name";

# Lets connect to the Database and set up the table
$link = mysql_connect($db_server,$db_username,$db_password);

$create_table = "CREATE TABLE IF NOT EXISTS `friendship_edges` (
  `referrer` varchar(30) NOT NULL,
  `friend` varchar(30) NOT NULL,
  `end` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  UNIQUE KEY `referrer` (`referrer`,`friend`,`start`,`end`)

$create = mysql_query($create_table);

# Now lets load the FB GRAPH API
#that means you have to place the facebook.php to the directory
#you can get facebook.php from many web sites, just google
require './facebook.php';

// Create our Application instance.
global $facebook;
$facebook = new Facebook(array(
  'appId'  => '1************8',
  'secret' => '9************4',
  'cookie' => false,

# get all users that have given us offline access
$user= "your profile_id";
$access_token="paste the token here";
#let's code as if this is a multi user app
#actually just you need it, but anyways
		#we read the friends of user.
			$attachment =  array('access_token' => $access_token);
			$result=$facebook->api('/me/friends', 'GET', $attachment);
		}catch(Exception $e){
			echo "oops could not do it ";
		#now let's start processing this friends list
		#first create a friends array for the list we just got from facebook
		$newfriends = Array();
		foreach($result['data'] as $f){
		#Do we have a list of friends stored in database?
		#who are new friends?	
		$resultNew = array_diff($newfriends, $oldfriends);
		#who deleted the user from his friends?
		$resultOld = array_diff($oldfriends, $newfriends);
		#write new friends to database
		foreach($resultNew as $indn => $frn){
		#record that a friend deleted the user, if any
		foreach($resultOld as $indo => $fro){

function getFriends($user){
	$sql = "SELECT friend FROM  `friendship_edges` WHERE  `referrer` =  '{$user}' AND end = '0000-00-00 00:00:00'";
	$result = mysql_query($sql);
	$rows = Array();
	while($row = mysql_fetch_array($result)){
		$rows [] = $row['friend'];
 	return $rows;


function writeEndDate($user,$friend){
	#someone deleted me, how dare!!!haha
	$sql = "UPDATE  `friendship_edges` SET  `end` =  CURRENT_TIMESTAMP,`start`=`start`  WHERE  `friendship_edges`.`referrer` =  '{$user}' AND  `friendship_edges`.`friend` =  '{$friend}' LIMIT 1";
	$result = mysql_query($sql);

function writeFriends($user,$friend){
	$sql = "INSERT INTO `friendship_edges` (`referrer`, `friend`,`start`) VALUES ('{$user}', '{$friend}', NOW())";
	$result = mysql_query($sql);


You can write a cronjob to run this script everyday and check who deleted you.

How do you write the cronjob? From what I learned from my colleagues (love you guys), you will need curl.

download and install PUTTY. Connect to your server and enter this

which curl

It will show you the address of curl, like /usr/bin/curl.

Again in PUTTY type

crontab -e

Now your crontab file will open. Add this line

00 23 * * * /usr/bin/curl http://localhost/crongetfriends.php 

You are done. Now you can query your mysql table to find who deleted you, or you can write a php script for interface.

this is the mysql query to see it

SELECT *  FROM `friendship_edges` WHERE `end` != '0000-00-00 00:00:00'