2011年3月31日 星期四

facebook api use on fb iframe canvas

Recently there is a case that runs on facebook iframe canvas with php, which needs login verification and retrive information at each page, so I wrote a sample php to do this. fbmain.php will verify user is login or not, retrive user information and tell if user is a fan of some page. Right below is the sample that includes fbmain.php.

(P.S. To run the sample code below you need to download lib folder from the attachment link first, and place at root of your project)

<?php

header ('Content-type: text/html; charset=utf-8');

include_once "lib/fbmain.php";

echo "UID=".$uid;
echo "NAME=".$fbme['name'];
echo "MAIL=".$fbme['email'];
echo "SEX=".$fbme['gender'];
echo "LOCATION=".$fbme['location']['name'];
echo "LOCALE=".$fbme['locale'];
echo "BIRTHDAY=".$fbme['birthday'];

echo "LIKES=".$likepage;

?>

2 則留言: