Esempio n. 1
0
function getFBEmbeedScript()
{
    $clientID = getFBClientID();
    $fbScript = "\n  <div id=\"fb-root\"></div>\n  <script>(function(d, s, id) {\n  var js, fjs = d.getElementsByTagName(s)[0];\n  if (d.getElementById(id)) return;\n  js = d.createElement(s); js.id = id;\n  js.src = \"//connect.facebook.net/en_US/sdk.js#xfbml=1&appId={$clientID}&version=v2.3\";\n  fjs.parentNode.insertBefore(js, fjs);\n  }(document, 'script', 'facebook-jssdk'));\n\n\n    try\n    {\n      FB.init({\n        appID: '{$clientID}',\n        version : 'v2.3',\n        status : true,\n        xfbml : true\n      });\n    }\n    catch(e)\n    {}\n\n\n</script>";
    //&version=v2.2
    return $fbScript;
}
Esempio n. 2
0
function getFBToken()
{
    $url = "https://graph.facebook.com/oauth/access_token";
    $params = array("client_id" => getFBClientID(), "client_secret" => getFBClientSecret(), "grant_type" => "client_credentials");
    $token = getAPI($url, $params);
    if (isset($token->curl_error)) {
        return null;
    }
    $token = explode('=', $token);
    return $token;
}