PHP Aplicacion facebook 1°parte
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP Aplicacion facebook 1°parte相关的知识,希望对你有一定的参考价值。
<?php
//DATOS APP
$fbconfig['appid' ] = "API_ID";
$fbconfig['secret'] = "SECRET_KEY";
//URL´s GENERALES
$fbconfig['baseUrl'] = "URL_ARCHIVOS";
$fbconfig['sitioUrl'] = "URL_DEL_SITIO";
$fbconfig['appUrl'] = "URL_DE_LA_APP_EN_FACEBOOK...HTTP://WWW.FACEBOOK.COM/PAGE/APP";
$fbconfig['appUrlCanvas'] = "APP_CANVAS...APPS.FACEBOOK.COM/MYAPLICATION";
$fbconfig['appBaseImg'] = $fbconfig['baseUrl']."img/";
$fbconfig['appBaseCss'] = $fbconfig['baseUrl']."css/";
$fbconfig['appBaseJs'] = $fbconfig['baseUrl']."js/";
$fbconfig['page_id'] = 'ID_PAGE';
$uid = null; //facebook user id
//Incluyo api de facebook
try{
include_once "../facebook/src/facebook.php";
}
catch(Exception $o){
echo '<pre>';
print_r($o);
echo '</pre>';
}
// Create our Application instance.
$facebook = new Facebook(array(
'appId' => $fbconfig['appid' ],
'secret' => $fbconfig['secret'],
'cookie' => true,
));
//Facebook Authentication part
//OBTENGO LAS OPCIONES DEL USUARIO
$user = $facebook->getUser();
$like_status = $signed_request["page"]["liked"];
$signed_request = $facebook->getSignedRequest();
$page_id = $signed_request["page"]["id"];
$page_admin = $signed_request["page"]["admin"];
$like_status = $signed_request["page"]["liked"];
$country = $signed_request["user"]["country"];
$locale = $signed_request["user"]["locale"];
$fbme = null;
if (!$user) {
//REQUERIR PERMISOS PARA EL USUARIO
$loginUrl = $facebook->getLoginUrl(array('scope' => 'email,publish_stream', 'redirect_uri' => $fbconfig['appUrl']));
}else {
try {
//obtengo el ID del usuario
$uid = $facebook->getUser();
//info usuario
$fbme = $facebook->api('/me');
$fbmefeed = $facebook->api('/me/feed');
$friends = $facebook->api('/me/friends');
$token = $facebook->getAccessToken();
} catch (FacebookApiException $e) {
error_log($e);
}
}
?>
以上是关于PHP Aplicacion facebook 1°parte的主要内容,如果未能解决你的问题,请参考以下文章
text Consola Aplicacion Unix
markdown 弹簧。 Primera Aplicacion
markdown Ejecutar una aplicacion web
ActionScript 3 cerrar aplicacion flash as3
markdown aplicacion no puede accessar unidad de red
PHP - 仅使用 Facebook 图表从 Facebook 页面获取帖子数据