当前位置: 首页>>代码示例>>PHP>>正文


PHP Facebook::getLoginStatusUrl方法代码示例

本文整理汇总了PHP中Facebook::getLoginStatusUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Facebook::getLoginStatusUrl方法的具体用法?PHP Facebook::getLoginStatusUrl怎么用?PHP Facebook::getLoginStatusUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Facebook的用法示例。


在下文中一共展示了Facebook::getLoginStatusUrl方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testLoginStatusURLCustom

 public function testLoginStatusURLCustom()
 {
     $_SERVER['HTTP_HOST'] = 'fbrell.com';
     $_SERVER['REQUEST_URI'] = '/examples';
     $facebook = new Facebook(array('appId' => self::APP_ID, 'secret' => self::SECRET));
     $encodedUrl1 = rawurlencode('http://fbrell.com/examples');
     $okUrl = 'http://fbrell.com/here1';
     $encodedUrl2 = rawurlencode($okUrl);
     $loginStatusUrl = $facebook->getLoginStatusUrl(array('ok_session' => $okUrl));
     $this->assertNotNull(strpos($loginStatusUrl, $encodedUrl1), 'Expect the current url to exist.');
     $this->assertNotNull(strpos($loginStatusUrl, $encodedUrl2), 'Expect the custom url to exist.');
     unset($_SERVER['HTTP_HOST']);
     unset($_SERVER['REQUEST_URI']);
 }
开发者ID:rnwldms,项目名称:php-sdk,代码行数:14,代码来源:tests.php

示例2: catch

// Facebook, but we don't know if the access token is valid. An access
// token is invalid if the user logged out of Facebook.
if ($user) {
    try {
        // Proceed knowing you have a logged in user who's authenticated.
        $user_profile = $facebook->api('/me');
    } catch (FacebookApiException $e) {
        error_log($e);
        $user = null;
    }
}
// Login or logout url will be needed depending on current user state.
if ($user) {
    $logoutUrl = $facebook->getLogoutUrl();
} else {
    $statusUrl = $facebook->getLoginStatusUrl();
    $loginUrl = $facebook->getLoginUrl();
}
// This call will always work since we are fetching public data.
$naitik = $facebook->api('/naitik');
?>
<!doctype html>
<html xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
    <title>php-sdk</title>
    <style>
        body {
            font-family: 'Lucida Grande', Verdana, Arial, sans-serif;
        }

        h1 a {
开发者ID:anmoldeep,项目名称:erp,代码行数:31,代码来源:example.php

示例3: social_site_login

    public function social_site_login($type)
    {
        $article = new postarticle();
        $image = new resizeImage();
        switch ($type) {
            case 'facebook':
                ?>


						<div id="fb-root"></div> 

						    <script src="http://connect.facebook.net/en_US/all.js"></script>  
						    <script> 
							    FB.init({ 
							      appId: '528594163842974', 
							      cookie: true,
							      status: true, 
							      xfbml: true 
							    }); 
						    </script>    

					        <?php 
                /** 
                 * Copyright 2011 Facebook, Inc.
                 *
                 * Licensed under the Apache License, Version 2.0 (the "License"); you may
                 * not use this file except in compliance with the License. You may obtain
                 * a copy of the License at
                 *
                 *     http://www.apache.org/licenses/LICENSE-2.0
                 *
                 * Unless required by applicable law or agreed to in writing, software
                 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
                 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
                 * License for the specific language governing permissions and limitations
                 * under the License.
                 * get friend list: https://developers.facebook.com/docs/graph-api/reference/user/friendlists/
                 */
                if ($mno != 136) {
                    // already logged in and redirecting to authenticate the account.
                    // echo " mno $mno <br>";
                    // $_SESSION['temp_mno'] = intval($mno);
                    // $this->go( 'login-authentication' );
                } else {
                    require '../../../fs_folders/API/facebook-php-sdk-master/src/facebook.php';
                    $facebook = new Facebook(array('appId' => '528594163842974', 'secret' => 'a411c8a3c4361556491b2c2ddf38bf21'));
                    $user = $facebook->getUser();
                    if ($user) {
                        try {
                            // $user_profile = $facebook->api('/me');
                            echo "user logon!";
                        } catch (FacebookApiException $e) {
                            error_log($e);
                            $user = null;
                            echo "user logout!";
                        }
                    }
                    if ($user) {
                        // echo " logout user";
                        $logoutUrl = $facebook->getLogoutUrl();
                    } else {
                        echo " set parametter to login ";
                        /*
                        								        $params = array(
                        								            'scope' =>'ads_management,create_event,create_note,email,export_stream,friends_about_me, 
                        								            	friends_activities, friends_birthday, friends_checkins, friends_education_history, friends_events, 
                        								            	friends_games_activity, friends_groups, friends_hometown, friends_interests, 
                        								            	friends_likes, friends_location, friends_notes, friends_online_presence, 
                        								            	friends_photo_video_tags, friends_photos, friends_questions, friends_relationship_details
                        								            	friends_relationships, friends_religion_politics, friends_status, friends_subscriptions
                        								            	friends_videos, friends_website, friends_work_history, manage_friendlists
                        								            	manage_notifications, manage_pages, offline_access, photo_upload, publish_actions
                        								            	publish_checkins, publish_stream, read_friendlists, read_insights, read_mailbox
                        								            	read_requests, read_stream, rsvp_event, share_item, sms, status_update, user_about_me
                        								            	user_activities, user_birthday, user_checkins, user_education_history, user_events
                        								            	user_games_activity, user_groups, user_hometown, user_interests, user_likes
                        								            	user_location, user_notes, user_online_presence, user_photo_video_tags, user_photos
                        								            	user_questions, user_relationship_details, user_relationships, user_religion_politics
                        								            	user_status, user_subscriptions, user_videos, user_website, user_work_history
                        								            	video_upload xmpp_login', 
                        								            	'redirect_uri' => 'http://fashionsponge.com/login'
                        								        );
                        */
                        $params = array('scope' => ' email,friends_about_me,user_about_me,user_birthday, user_education_history,
							            	user_games_activity, user_groups, user_hometown, user_interests, user_likes
							            	user_location, user_notes, user_online_presence, user_photo_video_tags, user_photos
							            	user_questions, user_relationship_details, user_relationships, user_religion_politics
							            	user_status, user_subscriptions, user_videos, user_website, user_work_history
							            	', 'redirect_uri' => 'http://fashionsponge.com/login');
                        $statusUrl = $facebook->getLoginStatusUrl();
                        $loginUrl = $facebook->getLoginUrl($params);
                    }
                }
                ?>
 

					        <!doctype html>
					        <html xmlns:fb="http://www.facebook.com/2008/fbml">
					          <head> 
					            <title>php-sdk FS-LogIN</title> 
//.........这里部分代码省略.........
开发者ID:jesus143,项目名称:fs-dev,代码行数:101,代码来源:fs.console.source.php

示例4: catch

$user = $facebook->getUser();
if ($user) {
    try {
    } catch (FacebookApiException $e) {
        error_log($e);
        $user = null;
    }
}
if ($user) {
    $logoutUrl = $facebook->getLogoutUrl();
} else {
    $loginUrl = $facebook->getLoginUrl(array('scope' => 'email'));
}
$profile = $facebook->api('/me?scope=email');
$params = array('ok_session' => 'A', 'no_user' => 'B', 'no_session' => 'C');
$url_is_log = $facebook->getLoginStatusUrl($params);
?>
<!doctype html>
<html xmlns:fb="http://www.facebook.com/2008/fbml">
	<head>
		<title>php-sdk</title>
		<style>
			body {
				font-family: 'Lucida Grande', Verdana, Arial, sans-serif;
			}
			h1 a {
				text-decoration: none;
				color: #3b5998;
			}
			h1 a:hover {
				text-decoration: underline;
开发者ID:centaurustech,项目名称:truc,代码行数:31,代码来源:facebook_connect.php

示例5: fblogin

    function fblogin( $fb_friends_in_fs ) {?>
      
                 





        <?php
        /** 
         * Copyright 2011 Facebook, Inc.
         *
         * Licensed under the Apache License, Version 2.0 (the "License"); you may
         * not use this file except in compliance with the License. You may obtain
         * a copy of the License at
         *
         *     http://www.apache.org/licenses/LICENSE-2.0
         *
         * Unless required by applicable law or agreed to in writing, software
         * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
         * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
         * License for the specific language governing permissions and limitations
         * under the License.
         * get friend list: https://developers.facebook.com/docs/graph-api/reference/user/friendlists/
         */

          require 'fs_folders/API/facebook-php-sdk-master/src/facebook.php';

        // Create our Application instance (replace this with your appId and secret).
        $facebook = new Facebook(array(
          'appId'  => '528594163842974',
          'secret' => 'a411c8a3c4361556491b2c2ddf38bf21',
        )); 

        // Get User ID
        $user = $facebook->getUser(); 
        // We may or may not have this data based on whether the user is logged in.
        //
        // If we have a $user id here, it means we know the user is logged into
        // Facebook, but we don't know if the access token is valid. An access
        // token is invalid if the user logged out of Facebook.

        if ($user) {
          try {
            // Proceed knowing you have a logged in user who's authenticated.
            $user_profile = $facebook->api('/me');
            echo "user logon!";
          } catch (FacebookApiException $e) {
            error_log($e);
            $user = null;
            echo "user logout!";
          }
        }

        // Login or logout url will be needed depending on current user state.
        if ($user) {
          $logoutUrl = $facebook->getLogoutUrl(); 
        } else {


          $params = array(
            'scope' =>'ads_management,create_event,create_note,email,export_stream,friends_about_me, 
              friends_activities, friends_birthday, friends_checkins, friends_education_history, friends_events, 
              friends_games_activity, friends_groups, friends_hometown, friends_interests, 
              friends_likes, friends_location, friends_notes, friends_online_presence, 
              friends_photo_video_tags, friends_photos, friends_questions, friends_relationship_details
              friends_relationships, friends_religion_politics, friends_status, friends_subscriptions
              friends_videos, friends_website, friends_work_history, manage_friendlists
              manage_notifications, manage_pages, offline_access, photo_upload, publish_actions
              publish_checkins, publish_stream, read_friendlists, read_insights, read_mailbox
              read_requests, read_stream, rsvp_event, share_item, sms, status_update, user_about_me
              user_activities, user_birthday, user_checkins, user_education_history, user_events
              user_games_activity, user_groups, user_hometown, user_interests, user_likes
              user_location, user_notes, user_online_presence, user_photo_video_tags, user_photos
              user_questions, user_relationship_details, user_relationships, user_religion_politics
              user_status, user_subscriptions, user_videos, user_website, user_work_history
              video_upload xmpp_login', 
            'redirect_uri' => 'http://fashionsponge.com/testPage.php'
          );




          $statusUrl = $facebook->getLoginStatusUrl();
          $loginUrl = $facebook->getLoginUrl($params);
            /* make the API call */
         echo " not login";
        /* handle the result */
        } 
        // This call will always work since we are fetching public data.
        $naitik = $facebook->api('/naitik');

        ?>
        <!doctype html>
        <html xmlns:fb="http://www.facebook.com/2008/fbml">
          <head>
            <title>php-sdk</title>
            <style>
              body {
                font-family: 'Lucida Grande', Verdana, Arial, sans-serif;
//.........这里部分代码省略.........
开发者ID:jesus143,项目名称:fs-dev,代码行数:101,代码来源:testPage.php

示例6: social_login

    public function social_login($type, $imgname = null, $link = null, $hoverImage = NULL, $id = NULL, $style = 'width:100%; height:auto;', $target = NULL)
    {
        switch ($type) {
            case 'facebook':
                ?>
	       				 	<!-- fb login  -->
								<div id="fb-root"></div>  
							    <script src="http://connect.facebook.net/en_US/all.js"></script>  
							    <script> 
								    // FB.init({ 
								    //   appId: '528594163842974', 
								    //   cookie: true,
								    //   status: true, 
								    //   xfbml: true 
								    // }); 
							    </script> 


							    <?php 
                require 'fs_folders/API/facebook-php-sdk-master/src/facebook.php';
                $facebook = new Facebook(array('appId' => '528594163842974', 'secret' => 'a411c8a3c4361556491b2c2ddf38bf21'));
                $user = $facebook->getUser();
                if ($user) {
                    try {
                        // $user_profile = $facebook->api('/me');
                        #echo "user logon!";
                    } catch (FacebookApiException $e) {
                        error_log($e);
                        $user = null;
                        #echo "user logout!";
                    }
                }
                if ($user) {
                    #echo " logout user";
                    $logoutUrl = $facebook->getLogoutUrl();
                    // $params = array(
                    //     'scope' =>' email,friends_about_me,user_about_me,user_birthday, user_education_history,
                    //     	user_games_activity, user_groups, user_hometown, user_interests, user_likes
                    //     	user_location, user_notes, user_online_presence, user_photo_video_tags, user_photos
                    //     	user_questions, user_relationship_details, user_relationships, user_religion_politics
                    //     	user_status, user_subscriptions, user_videos, user_website, user_work_history
                    //     	',
                    //     	'redirect_uri' => 'http://fashionsponge.com/social-fblogin-authenticate.php'
                    // );
                    $params = array('scope' => 'email', 'user_likes', 'user_about_me', 'name', 'first_name', 'last_name', 'age_range', 'link', 'gender', 'locale', 'timezone', 'user_education_history', 'user_hometown', 'user_website', 'user_work_history', 'user_birthday', 'redirect_uri' => 'http://dev.fashionsponge.com/social-fblogin-authenticate.php');
                    // $params = array(
                    //     'scope' =>' email,friends_about_me,user_about_me,user_birthday, user_education_history,
                    //     	user_games_activity, user_groups, user_hometown, user_interests, user_likes
                    //     	user_location, user_notes, user_online_presence, user_photo_video_tags, user_photos
                    //     	user_questions, user_relationship_details, user_relationships, user_religion_politics
                    //     	user_status, user_subscriptions, user_videos, user_website, user_work_history
                    //     	',
                    //     	'redirect_uri' => 'http://fashionsponge.com/social-fblogin-authenticate.php'
                    // );
                    $statusUrl = $facebook->getLoginStatusUrl();
                    $loginUrl = $facebook->getLoginUrl($params);
                } else {
                    #echo " set parametter to login ";
                    // $params = array(
                    //           'scope' =>' email,friends_about_me,user_about_me,user_birthday, user_education_history,
                    //           	user_games_activity, user_groups, user_hometown, user_interests, user_likes
                    //           	user_location, user_notes, user_online_presence, user_photo_video_tags, user_photos
                    //           	user_questions, user_relationship_details, user_relationships, user_religion_politics
                    //           	user_status, user_subscriptions, user_videos, user_website, user_work_history
                    //           	',
                    //           	'redirect_uri' => 'http://fashionsponge.com/social-fblogin-authenticate.php'
                    //       );
                    $params = array('scope' => 'email', 'user_likes', 'user_about_me', 'name', 'first_name', 'last_name', 'age_range', 'link', 'gender', 'locale', 'timezone', 'user_education_history', 'user_hometown', 'user_website', 'user_work_history', 'user_birthday', 'redirect_uri' => 'http://dev.fashionsponge.com/social-fblogin-authenticate.php');
                    $statusUrl = $facebook->getLoginStatusUrl();
                    $loginUrl = $facebook->getLoginUrl($params);
                }
                return $loginUrl;
                break;
            case 'print-image':
                echo "<a href='{$link}' target='{$target}' >\n\t       \t\t\t\t\t\t\t<img  \n\t       \t\t\t\t\t\t\t\tid='{$id}' \n\t       \t\t\t\t\t\t\t\tsrc='{$imgname}' \n\t       \t\t\t\t\t\t\t\tstyle='{$style}' \n\t       \t\t\t\t\t\t\t\tonmouseover=\"mousein_change_button ( '#{$id}' , '{$hoverImage}' )\"   \n\t       \t\t\t\t\t\t\t\tonmouseout=\"mousein_change_button ( '#{$id}' , '{$imgname}' )\"\n\t       \t\t\t\t\t\t\t/>\n\t       \t\t\t\t\t\t</a>";
                break;
            default:
                break;
        }
    }
开发者ID:jesus143,项目名称:fs-dev,代码行数:80,代码来源:myclass.php

示例7: fbooklog

 function fbooklog()
 {
     require 'facebook.php';
     $facebook = new Facebook(array('appId' => '613331932053999', 'secret' => '67ca1bf4c03ee0481ed13099676141de'));
     $user = $facebook->getUser();
     if ($user) {
         try {
             // Proceed knowing you have a logged in user who's authenticated.
             $user_profile = $facebook->api('/me');
         } catch (FacebookApiException $e) {
             error_log($e);
             $user = null;
         }
     }
     $deal_user = $facebook->api('/me');
     if ($user) {
         // $logoutUrl;
         /*	echo "<pre>";
         
         print_r($deal_user);
         
         echo "</pre>";die;*/
         $here = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
         $next = preg_replace('~#.*$~s', '', $here);
         $next = preg_replace('~\\?.*$~s', '', $next);
         $next = preg_replace('~/[^/]*$~s', '/logout.php', $next);
         $logoutUrl = $facebook->getLogoutUrl(array('next' => $next));
         $facebook_user = mysql_query("select * from " . USERS . " where user_name='" . $deal_user['username'] . "'");
         // echo $facebook_user;die;
         $location = $deal_user['location']['name'];
         //echo $facebook_user;die;
         $pic_url = "https://graph.facebook.com/" . $user . "/picture?type=large";
         //$n=mysql_num_rows($facebook_user);
         // echo $n;die;
         if (mysql_num_rows($facebook_user) == 0) {
             mysql_query("insert into " . USERS . " set name='" . $deal_user['name'] . "',user_name='" . $deal_user['username'] . "',email='" . $deal_user['username'] . "',profile_picture='" . $user . "',profile_picture_url='" . $pic_url . "',joindate=NOW()");
             $s = mysql_query("select * from " . USERS . " where user_id=" . mysql_insert_id());
             //echo $s;die;
             $resulet = mysql_fetch_assoc($s);
             //print_r($resulet);
             $SessionArray = array();
             foreach ($resulet as $k => $v) {
                 $SessionArray[$k] = $v;
             }
             $_SESSION['user'] = $SessionArray;
             header("location:./");
             //$_SESSION['user']['user_id']=
         } else {
             $u = mysql_query("update " . USERS . " set set name='" . $deal_user['name'] . "',user_name='" . $deal_user['username'] . "',profile_picture='" . $user . "',profile_picture_url='" . $pic_url . "',joindate=NOW() where email='" . $deal_user['username'] . "'");
             //echo $u;die;
             $resulet = mysql_fetch_assoc(mysql_query("select * from " . USERS . " where email='" . $deal_user['username'] . "'"));
             $SessionArray = array();
             foreach ($resulet as $k => $v) {
                 $SessionArray[$k] = $v;
             }
             $_SESSION['user'] = $SessionArray;
             header("location:./");
         }
     } else {
         $here = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
         $next = preg_replace('~#.*$~s', '', $here);
         $next = preg_replace('~\\?.*$~s', '', $next);
         $next = preg_replace('~/[^/]*$~s', '/index.php', $next);
         //global $statusUrl;
         //global $loginUrl;
         $statusUrl = $facebook->getLoginStatusUrl();
         $loginUrl = $facebook->getLoginUrl(array('next' => $next));
     }
     return $loginUrl;
 }
开发者ID:Raju6609,项目名称:deals,代码行数:70,代码来源:functions.php


注:本文中的Facebook::getLoginStatusUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。