Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <pre>
- <?php
- @ini_set('max_execution_time', 0);
- @set_time_limit(0);
- class fb {
- var $FACEBOOK_DEVELOPER_PAGE = "https://developers.facebook.com/docs/reference/api/";
- var $URL = "https://graph.facebook.com";
- var $BASIC_URL = "/me";
- var $NEWS_URL = "/me/home";
- var $WALL_URL = "/me/feed";
- var $FRIENDS_URL = "/me/friends";
- var $LIKES_URL = "/me/likes";
- var $MOVIES_URL = "/me/movies";
- var $MUSIC_URL = "/me/music";
- var $BOOKS_URL = "/me/books";
- var $PERMISSIONS_URL = "/me/permissions";
- var $PHOTOS_URL = "/me/photos";
- var $ALBUMS_URL = "/me/albums";
- var $VIDEOS_URL = "/me/videos";
- var $EVENTS_URL = "/me/events";
- var $GROUPS_URL = "/me/groups";
- var $CHECKINS_URL = "/me/checkins";
- private $cookies, $access_token;
- public $profile;
- function __construct($cookies) {
- $this->cookies = $cookies;
- $this->getFacebookGraphAccessToken();
- $this->getProfileData();
- }
- private function getFacebookGraphAccessToken() {
- $conn = $this->connect($this->FACEBOOK_DEVELOPER_PAGE, 1, $this->cookies);
- preg_match("/access_token=(\w+)/", $conn, $matches);
- $this->access_token = $matches[1];
- }
- private function getProfileData() {
- $this->profile = json_decode($this->connect($this->URL.$this->BASIC_URL.'?access_token='.$this->access_token, 1, $this->cookies));
- }
- function Profile() {
- return $this->profile;
- }
- function getPages() {
- $ret = array();
- $pg = json_decode($this->connect($this->URL.$this->LIKES_URL."?access_token=".$this->access_token, 1, $this->cookies));
- $ret['total_page'] = count($pg->data);
- $ret['page'] = $pg->data;
- return $ret;
- }
- function PageData($id) {
- return json_decode($this->connect('https://graph.facebook.com/'.$id));
- }
- function FriendData($id) {
- return json_decode($this->connect('https://graph.facebook.com/'.$id));
- }
- function getFriends() {
- $ret = array();
- $fr = json_decode($this->connect($this->URL.$this->FRIENDS_URL."?access_token=".$this->access_token, 1, $this->cookies));
- $ret['total_friend'] = count($fr->data);
- $ret['friend'] = $fr->data;
- return $ret;
- }
- function connect($url,
- $use_cookies = 0,
- $cookies = '',
- $ua = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)') {
- $conn = curl_init($url);
- curl_setopt( $conn, CURLOPT_CONNECTTIMEOUT, 30 );
- curl_setopt( $conn, CURLOPT_SSL_VERIFYPEER, false );
- curl_setopt( $conn, CURLOPT_SSL_VERIFYHOST, 1 );
- curl_setopt( $conn, CURLOPT_RETURNTRANSFER, true );
- curl_setopt( $conn, CURLOPT_FOLLOWLOCATION, true );
- curl_setopt( $conn, CURLOPT_USERAGENT, $ua );
- if($use_cookies) {
- curl_setopt( $conn, CURLOPT_COOKIE, $cookies );
- }
- curl_setopt( $conn, CURLOPT_POST, false );
- try {
- $result = curl_exec( $conn );
- curl_close( $conn );
- } catch (Exception $ex) {
- die("Connect: {$ex->getMessage()}");
- return null;
- }
- return $result;
- }
- }
- $cookies = array(
- "asiakarensri" => "datr=9Gz4Ta8-gIq5P8OlB644uWV_; lu=ggdjx4iJNAA3ZVYzJK65P89w; c_user=100000933666643; xs=1%3A277f05d24816e5944c4d09751b5da3b0%3A0%3A1325609978; p=1; act=1326182339325%2F83%3A2; presence=EDvFA22A2EtimeF1326195394EstateFDutF1326195394019EvisF0EvctF0H0EblcF0EsndF0OQ1326174217EsF0CEchFDp_5f1B00933666643F93CC",
- "fredmontana" => "datr=-AziTuQ2iZAHJqXQSDHS0MM9; lu=SgrZuYpIZ6FAYyM0VOa-yBbg; c_user=1545069838; xs=61%3A83f9ba77dba340141a5c53ef11c4a036%3A0%3A1324883154; p=2; act=1325941538046%2F5%3A2; presence=EDvFA22A2EtimeF1326193229EstateFDutF1326193229356EvisF1EvctF0H0EblcF0EsndF1OQ1325941548EsF0CEchFDp_5f1545069838F0CC",
- //"danielhunt" => "locale=en_GB; act=1326194800036%2F0%3A2; c_user=508119909; datr=q_ygTqhXnljJUAWciO1-16r2; lu=RgZ6VXya62pBSCqgZ_lix-rA; xs=60%3A7c306ceb65c6fc8fbc2a4c76727054c5%3A0%3A1326194835; p=0; wd=1024x499; presence=EDvFA22A2EtimeF1326194855EstateFDutF1326194855573EvisF1EvctF0H0EblcF0EsndF0OQ0EsF0CEchFDp_5f508119909F1CC",
- );
- $fb = new fb($cookies['asiakarensri']);
- $fbfriend = $fb->getFriends();
- $fbpage = $fb->getPages();
- ?>
- <style>
- table td{
- background: #FFFEB2;
- color: #0C0C0C;
- border-bottom: 1px solid #FFED45;
- border-right: 1px solid #FFED45;
- padding: 3px;
- }
- table th{
- padding: 5px;
- background: #FFF064;
- color: #060606;
- }
- </style>
- <table width='100%' border='0'>
- <tr>
- <td colspan='2'>
- <table width='100%' border='0'>
- <tr>
- <td width='10%' align="center"><img src="https://graph.facebook.com/<?=$fb->Profile()->id?>/picture"></td>
- <td>
- <table width='100%' border='0'>
- <tr>
- <td>
- <a href="<?=$fb->Profile()->link?>"><?=$fb->Profile()->name?></a>
- </td>
- </tr>
- <tr>
- <td>
- Gender: <?=$fb->Profile()->gender?>. Lives in <?=$fb->Profile()->location->name?>. Born on <?=$fb->Profile()->birthday?>, <?php if(!empty($fb->Profile()->relationship_status) AND isset($fb->Profile()->relationship_status)): ?>Relation Status <?=$fb->Profile()->relationship_status?><?php endif;?>
- </td>
- </tr>
- <tr>
- <td>About: <?=$fb->Profile()->about?></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td width="50%">Total Page Like: <?=$fbpage['total_page']?>
- <div style='overflow:auto; height:300px'>
- <table width="100%" style='overflow:auto; height:300px'>
- <?php
- for($i=0;$i<$fbpage['total_page'];$i++) {
- //$pgdata = $fb->PageData($fbpage['page'][$i]->id);
- print "<tr>";
- print "<td align=\"center\"><img src=\"https://graph.facebook.com/".$fbpage['page'][$i]->id."/picture\"></td>";
- print "<td><a href=\"http://www.facebook.com/profile.php?id=".$fbpage['page'][$i]->id."\">".$fbpage['page'][$i]->name."</a></td>";
- print "</tr>\n";
- }
- ?>
- </table>
- </div>
- </td>
- <td>Total Friends: <?=$fbfriend['total_friend']?>.
- <div style='overflow:auto; height:300px'>
- <table width="100%" style='overflow:auto; height:300px'>
- <?php
- for($i=0;$i<$fbfriend['total_friend'];$i++) {
- //$frdata = $fb->FriendData($fbfriend['friend'][$i]->id);
- print "<tr>";
- print "<td align=\"center\"><img src=\"https://graph.facebook.com/".$fbfriend['friend'][$i]->id."/picture\"></td>";
- print "<td><a href=\"http://www.facebook.com/profile.php?id=".$fbfriend['friend'][$i]->id."\">".$fbfriend['friend'][$i]->name."</a></td>";
- print "</tr>\n";
- }
- ?>
- </table>
- </div>
- </td>
- </tr>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement