Narisa.com: ลองเล่น Facebook API - Narisa.com

Jump to content

Subscribe to Patrickz's Blog        RSS Feed

ลองเล่น Facebook API

Leave Comment
ไม่ค่อยมีใครเขียนblog เกี่ยวกับการพัฒนาโปรแกรมบน Facebook เลย ที่เห็นก็มี เริ่มต้นกับการเขียน Facebook Application สำหรับผู้เริ่มต้น (PHP) แค่นั้นเอง

Resource

ตัวอย่างจาก "Quick Creation Guide"
ใช้ PHP คู่กับ facebook php lib
<html>
 <body bgcolor="#EFEFEF">
 <?php
	   // Copyright 2007 Facebook Corp.  All Rights Reserved. 
	   // 
	   // Application: CustomBlock
	   // File: 'index.php' 
	   //   This is a sample skeleton for your application. 
	   // 
	   
	   require_once 'facebook.php';
	   
	   $appapikey = '2341a3d3dbdd56027ff68ac20d88ea21';
	   $appsecret = '453e2f1c901fc7363271c9f52338043f';
	   $facebook = new Facebook($appapikey, $appsecret);
	   $user_id = $facebook->require_login();
	   
	   // Greet the currently logged-in user!
	   echo "<p>Hello, <fb:name uid=\"$user_id\" useyou=\"false\" />!</p>";
	   
	   // Print out at most 25 of the logged-in user's friends,
	   // using the friends.get API method
	   echo "<p>Friends:";
	   $friends = $facebook->api_client->friends_get();
	   $friends = array_slice($friends, 0, 25);
	   foreach ($friends as $friend) {
		 echo "<br>$friend";
	   }
	   echo "</p>";
 </body>
 </html>



Posted Image

0 Comments On This Entry

 

September 2010

S M T W T F S
   12 3 4
567891011
12131415161718
19202122232425
2627282930  

Search My Blog

Recent Comments

test

test