本教程(http://bit.ly/hYEVYF)有助于熟悉C#& Visual Studio,但它实现了不同的目标。
这是PHP代码(完美地运行):
<?php require 'lib/facebook.php';
$facebook = new Facebook( array(
'appId' => APP_ID,
'secret' => APP_SECRET,
'cookie' => true
) );
try {
$me = $facebook->api('/me');
} catch ( FacebookApiException $e ) {
error_log( $e );
}
$signed_request = $facebook->getSignedRequest();
$liked = $signed_request['page']['liked'];
?>
<?php
if ( $liked ) : ?>
YOU LIKE US!
<?php else : ?>
YOU DON'T LIKE US YET!
<?php endif; ?>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>