Skip to content

Instantly share code, notes, and snippets.

@opnchaudhary
Created February 5, 2013 08:38
Show Gist options
  • Save opnchaudhary/4713093 to your computer and use it in GitHub Desktop.
Save opnchaudhary/4713093 to your computer and use it in GitHub Desktop.
Simple library to assist in getting the Facebook Fan Page Id
<?php
/**
* A simple library to assist in getting the Facebook Fan Page Id
* @author Paras Nath Chaudhary
* @copyright CopyLeft (ↄ) 2013, writephp.blogspot.com
* @license GPL
* @since Version 1.0
* @version 1.0
Implementation
================
<?php
require_once 'facebookHelper.php';
echo getPageId("http://www.facebook.com/nosklub");
?>
*/
function getPageId($fanpageUrl){
$url=str_replace('www', 'graph', $fanpageUrl);
$json = file_get_contents($url);
$contents=json_decode($json);
return $contents->id;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment