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


PHP Facebook::getApiSecret方法代码示例

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


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

示例1: facebook_init

function facebook_init()
{
    require 'src/facebook.php';
    global $facebook;
    $facebook = new Facebook(array('appId' => FB_KEY, 'secret' => FB_SECRET));
    if (!empty($_SESSION) && !empty($_SESSION['fb_code'])) {
        $url = "https://graph.facebook.com/oauth/access_token?";
        $params = array();
        $params[] = 'client_id=' . $facebook->getAppId();
        $params[] = 'redirect_uri=' . 'http://' . HOST . get_url('/facebook/auth/');
        $params[] = 'client_secret=' . $facebook->getApiSecret();
        $params[] = 'code=' . $_SESSION['fb_code'];
        $url .= implode('&', $params);
        $data = explode('&', get_data($url));
        foreach ($data as &$d) {
            $d = explode('=', $d);
            if ($d[0] == 'access_token') {
                $_SESSION['fb_access_token'] = $d[1];
            } elseif ($d[0] == 'expires') {
                $_SESSION['fb_at_expires'] = time() + $d[1];
            }
        }
    }
    if (array_key_exists('fb_access_token', $_SESSION)) {
        if ($_SESSION['fb_at_expires'] > time()) {
            $facebook->setAccessToken($_SESSION['fb_access_token']);
            unset($_SESSION['fb_code']);
        }
    }
}
开发者ID:nodefortytwo,项目名称:engagement,代码行数:30,代码来源:facebook.php

示例2: getAccess

 public function getAccess($token, $secret, $verifier)
 {
     $code = JRequest::getVar('code');
     $params = array('client_id' => parent::getAppId(), 'redirect_uri' => $this->callback, 'client_secret' => parent::getApiSecret(), 'code' => $code);
     $token = parent::_oauthRequest(parent::getUrl('graph', '/oauth/access_token'), $params);
     $token = str_ireplace('access_token=', '', $token);
     $obj = new stdClass();
     $obj->token = $token;
     $obj->secret = 'facebook';
     $obj->params = '';
     return $obj;
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:12,代码来源:helper.php

示例3: testSetAPISecret

 public function testSetAPISecret()
 {
     $facebook = new Facebook(array('appId' => self::APP_ID, 'secret' => self::SECRET));
     $facebook->setApiSecret('dummy');
     $this->assertEquals($facebook->getApiSecret(), 'dummy', 'Expect the API secret to be dummy.');
 }
开发者ID:rnwldms,项目名称:php-sdk,代码行数:6,代码来源:tests.php

示例4: array

<?php

/**
/* This code verifies that the authorization succeded. 
**/
//Include libraries
require '../facebook.php';
require '../appengine_functions.php';
//Initialize Facebook's PHP library
$config = array('appId' => '140229329376512', 'secret' => '198fb6f72dfb3a029d410d98e3beb203', 'cookie' => true, 'domain' => true);
$facebook_client = new Facebook($config);
//Initialize variables
$app_id = $facebook_client->getAppId();
$app_secret = $facebook_client->getApiSecret();
$CANVAS_URL = 'http://apps.facebook.com/russ_myfirstapp/';
//Get the access token from Facebook by supplying the App ID & Secret.
$params = array('client_id' => $app_id, 'type' => 'client_cred', 'client_secret' => $app_secret);
$url = "https://graph.facebook.com/oauth/access_token";
$access_token = make_request($url, $params);
// creates a POST request with $params as the parameters.
$access_token = substr($access_token, strpos($access_token, "=") + 1, strlen($access_token));
//If the access token is not present, something went wrong
//so display an error, else, redirect to canvas page.
if ($access_token) {
    header('Location: ' . $CANVAS_URL);
} else {
    echo 'An error occurred';
}
exit;
开发者ID:russelnickson,项目名称:Friend-vs-Friend--Facebook-app-,代码行数:29,代码来源:index.php

示例5: function

    print_r($bindings);
    print_r($time);
    print_r($name);
});
*/
$app->hook("slim.before", function () use($facebook) {
    /* IE has problems with crossdomain cookies. */
    header('P3P: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
    /* When using FB.ui("oauth", ...) */
    /* Apparently FB.login() is now inline so this is not necessary */
    /* anymore http://goo.gl/22sfO */
    if (isset($_REQUEST["session"])) {
        $session_data = json_decode($_REQUEST["session"], true);
        $url = "https://graph.facebook.com/oauth/exchange_sessions";
        $curl = curl_init($url);
        $post = array("client_id" => $facebook->getAppId(), "client_secret" => $facebook->getApiSecret(), "sessions" => $session_data["session_key"]);
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        $response = curl_exec($curl);
        curl_close($curl);
        $exchange_data = json_decode($response, true);
        $access_token = $exchange_data[0]["access_token"];
        /* Save access toke to session since not all  */
        /* requests come from Facebook iframe. */
        $_SESSION["access_token"] = $access_token;
    }
    /* When using FB.login(...) or already installed. */
    if (isset($_REQUEST["signed_request"])) {
        $signed_request = $facebook->getSignedRequest();
        if (isset($signed_request["oauth_token"])) {
开发者ID:mateerladnam,项目名称:slim-facebook,代码行数:31,代码来源:app.php


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