<?php
$id = 112470202110722;

$url = "http://graph.facebook.com/ActivaStudio/feed?fields=from,message,picture,link,name,caption,description,icon,likes,comments&limit=1";



function parseDateFB ($unparsedDate) {
	// yyyy-mm-ddThh:mm:ss+0000
	$date = explode ("T", $unparsedDate);
	// dddmmyy
	$ddmmyy = explode ("-", $date[0]);
	
	// day
	$dateArray[0] = $ddmmyy[2];
	
	// month
	$dateArray[1] = $ddmmyy[1];
	
	// year
	$dateArray[2] = $ddmmyy[0];
	
	return $dateArray;

}

// create curl resource
$ch = curl_init();

// set url
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_HTTPHEADER,array ("Content-Type: text/xml; charset=utf-8"));
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// $output contains the output string
$output = curl_exec($ch);
//$output = utf8_encode($output);
//echo $output;

$param = json_decode($output, true);


// FROM NAME $param['data'][0]['from']['name']
// MESSAGE $param['data'][0]['message']
// PISTURE $param['data'][0]['picture']
// LINK $param['data'][0]['link']
// NAME $param['data'][0]['name']
// CAPTION $param['data'][0]['caption']
// DESCRIPTION $param['data'][0]['description']
// ** ICON $param['data'][0]['icon']
// LIKES $param['data'][0]['likes']
// CREATED_TIME $param['data'][0]['created_time']  yyyy-mm-ddThh:mm:ss+0000

// COMMENTS $param['data'][0]['comments']
// FROM                ...               ['data'][0]['from']['name']
// MESSAGE             ...               ['data'][0]['message']
// CREATED_TIME        ...               ['data'][0]['created_time']  yyyy-mm-ddThh:mm:ss+0000



// close curl resource to free up system resources
curl_close($ch);   

?>