Get PID from FBID


Hits: 6720  
<?php

include("lib/facebook.php");

$APPLICATION_ID = "xxxxxxxxxxxxxxx";
$APPLICATION_SECRET = "yyyyyyyyyyyyyyyyyyyyyyyyyyyy";

$facebook = new Facebook(array(
'appId'  => $APPLICATION_ID,
'secret' => $APPLICATION_SECRET,
'cookie' => true
));

$fbid="xxxxxxxxxx";

$fql = "SELECT pid FROM photo WHERE object_id=".$fbid;

$param  =   array(
 'method'    => 'fql.query',
 'query'     => $fql,
 'callback'  => ''
);

$fqlResult   =   $facebook->api($param);

$fql = "SELECT src_small, src_big  FROM photo WHERE pid = '".$fqlResult[0]['pid']."' ";

$param  =   array(
 'method'    => 'fql.query',
 'query'     => $fql,
 'callback'  => ''
);

$fqlResult   =   $facebook->api($param);

echo $fqlResult[0]['src_big'];
print_r(getimagesize($fqlResult[0]['src_big']));

echo "http://www.facebook.com/photo.php?fbid='".$fbid."' ";

?>

Life is the art of drawing without an eraser.So be careful while taking any small decisions about the valuable pages of life.

Published by

Sandeep Verma

I’m an Entrepreneur. I’m proud to work as Blogger, LAMP Programmer, Linux Admin, Web Consultant, Cloud Manager, Apps Developer, Searcher. Concentrate > Observe > Imagine > Launch