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


PHP Facebook::IsATValid方法代码示例

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


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

示例1: trim

	<p class='alerttext'>JavaScript MUST be enabled in order for you to use kingposter. However, it seems JavaScript is either disabled or not supported by your browser. If your browser supports JavaScript, Please enable JavaScript by changing your browser options, then try again.</p></div>
</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: Facebook

<?php

require "../core/init.php";
// Add new facebook account using access token
if (Input::Get("fb_accesstoken")) {
    $fb = new Facebook();
    $user = new User();
    $fbaccount = new fbaccount();
    // Test access token
    if (!$fb->IsATValid(Input::Get("fb_accesstoken"))) {
        echo lang('INVALID_ACCESS_TOKEN');
        exit;
    }
    // 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"));
开发者ID:andersoonluan,项目名称:PHP,代码行数:31,代码来源:fbaccount.php


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