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


PHP Facebook::GetAccessToken方法代码示例

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


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

示例1: trim

</noscript>
<div class='alerts'></div>
<?php 
if (isset($_POST['submit'])) {
    $accessToken = trim($_POST['accessToken']);
    if (empty($accessToken)) {
        echo "<script> alertBox('" . lang('ENTER_ACCESS_TOKEN') . "','danger');</script>";
    } else {
        $user = new User();
        $fb = new Facebook();
        $fb_account = new FbAccount();
        $app_id = "145634995501895";
        try {
            if ($fb_account->UserDefaultFbAccount()) {
                if ($fb->IsATValid($accessToken)) {
                    if ($fb->GetAccessToken($app_id)) {
                        $fb->UpdateAccessToken($user->data()->id, $app_id, $fb_account->UserDefaultFbAccount(), $accessToken);
                    } else {
                        $fb->SaveAccessToken($user->data()->id, $app_id, $fb_account->UserDefaultFbAccount(), $accessToken);
                    }
                    echo "<script>window.opener.location.href;window.close();</script>";
                } else {
                    throw new Exception(lang('INVALID_ACCESS_TOKEN'));
                }
            } else {
                throw new Exception(lang('NO_FB_ACCOUNT_SELECTED'));
            }
        } catch (Exception $e) {
            echo "<script> alertBox('" . $e->getMessage() . "','danger');</script>";
        }
    }
开发者ID:andersoonluan,项目名称:PHP,代码行数:31,代码来源:resetaccesstoken.php

示例2: FbAuth

									<td></td>
								</tr>
							</thead>
							<script>
								function FbAuth(app_id){
									var oldApi = "";
									if($('#oldApi').is(":checked")){
										oldApi = "&oldApi=true"
									}
									window.open('FbAuth.php?app_id='+app_id+oldApi,'','height=500,width=600');
								}
							</script>
							<tbody id="fbapps">
								<?php 
foreach ($fbapps->getAll() as $fbapp) {
    if ($fb->GetAccessToken($fbapp->getAppId())) {
        $statusIcon = "ok";
        $statusText = lang('AUTHENTICATED');
        $statusBtn = "";
        $oldApi = Input::Get("oldApi") ? "&oldApi=true" : "";
    } else {
        $statusIcon = "remove";
        $statusText = lang('NOT_AUTHENTICATED');
        if ($fbapp->appType($fbapp->getAppId()) == 2) {
            $statusBtn = "<button onclick=\"window.open('resetaccesstoken.php','','height=570,width=600'); return false;\" class='btn btn-primary'>" . lang('AUTHENTICATE') . "</button> ";
        }
        if ($fbapp->appType($fbapp->getAppId()) == 3) {
            $statusBtn = "<button onclick=\"window.open('defaultappauth.php?app_id=" . $fbapp->getAppId() . "','','height=470,width=600'); return false;\" class='btn btn-primary'>" . lang('AUTHENTICATE') . "</button> ";
        }
        if ($fbapp->appType($fbapp->getAppId()) == 1) {
            $statusBtn = "<button onclick='FbAuth(" . $fbapp->getAppId() . ");return false;' class='btn btn-primary'>" . lang('AUTHENTICATE') . "</button>";
开发者ID:andersoonluan,项目名称:PHP,代码行数:31,代码来源:settings.php

示例3: lang

?>
									</small>
							</div>
													</div>
						<div class="col-lg-6">
							<label for="scheduledPostApp"><?php 
echo lang('FB_APP');
?>
</label>
							<select name='scheduledPostApp' id="scheduledPostApp" class="form-control">
								<?php 
if ($fb->AppsList()) {
    $selected = Input::Get('scheduledPostApp') ? Input::Get('scheduledPostApp') : $fbaccount->UserFbAccountDefaultApp();
    foreach ($fb->AppsList() as $app) {
        $select = $selected == $app->appid ? "selected" : "";
        if ($fb->GetAccessToken($app->appid)) {
            echo "<option value='" . $app->appid . "' " . $select . ">" . $app->app_name . "</option>";
        }
    }
}
?>
							</select>
						</div>
					</div>
					
					<div class="row">
						<div class="col-lg-12">
							<button onclick="return false;" class='btn btn-primary' id="saveScheduledPost" name='scheduledpost'>
								<span class="glyphicon glyphicon-time"></span> <?php 
echo lang("SAVE_SCHEDULED_POSTS");
?>
开发者ID:andersoonluan,项目名称:PHP,代码行数:31,代码来源:index.php

示例4: lang

 }
 // get facebook User info
 $userData = $fb->GetUserFromAccessToken(Input::Get("fb_accesstoken"));
 if ($userData == null) {
     echo lang("UNABLE_TO_GET_FB_ACCOUNT_DETAILS");
     exit;
 }
 // Get user groups
 $fbgroups = $fb->LoadFbGroups(Input::Get("fb_accesstoken"));
 if (!$fbgroups) {
     echo lang("UNABLE_GET_FB_GROUPS");
     exit;
 }
 // Save access token
 if ($fbAppDetails = $fb->AppDetailsFromAt(Input::Get("fb_accesstoken"))) {
     if ($fb->GetAccessToken($fbAppDetails->id, $userData->id)) {
         $fb->UpdateAccessToken($user->data()->id, $fbAppDetails->id, $userData->id, Input::Get("fb_accesstoken"));
     } else {
         $fb->SaveAccessToken($user->data()->id, $fbAppDetails->id, $userData->id, Input::Get("fb_accesstoken"));
     }
 } else {
     echo lang("UNABLE_TO_GET_FB_APP_DETAILS");
     exit;
 }
 // Save new facebook account
 $fbaccount->setUserId($user->data()->id);
 $fbaccount->setFbId($userData->id);
 $fbaccount->setLastname($userData->first_name);
 $fbaccount->setFirstname($userData->last_name);
 $fbaccount->setGroups($fbgroups);
 if (!$fbaccount->UserFbAccountDefaultApp()) {
开发者ID:andersoonluan,项目名称:PHP,代码行数:31,代码来源:fbaccount.php


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