Ver Mensaje Individual
  #2 (permalink)  
Antiguo 24/07/2011, 14:48
johhan16
 
Fecha de Ingreso: junio-2010
Ubicación: Venezuela, Zulia
Mensajes: 686
Antigüedad: 13 años, 10 meses
Puntos: 55
Respuesta: Hacer esta "funcion" en pagina de facebook

yo en una aplicacion que uso en el facebook uso este codigo

Código PHP:

<?php
/**
*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/


require 'src/facebook.php';

// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
  
'appId' => '1231321321321321',
  
'secret' => '651df65gsdf5g16sd5fg65s1d65g',
  
'cookie' => true,
));

// We may or may not have this data based on a $_GET or $_COOKIE based session.
//
// If we get a session here, it means we found a correctly signed session using
// the Application Secret only Facebook and the Application know. We dont know
// if it is still valid until we make an API call using the session. A session
// can become invalid if it has already expired (should not be getting the
// session back in this case) or if the user logged out of Facebook.
$session $facebook->getSession();

$me null;
// Session based API call.
if ($session) {
  try {
    
$uid $facebook->getUser();
    
$me $facebook->api('/me');
  } catch (
FacebookApiException $e) {
    
error_log($e);
  }
}



?>
<!doctype html>
<html xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>Conectado como</title>

<link type="text/css" rel="stylesheet" href="http://radio.centerhipico.com/css/titulo_imagen.css" />


<style type="text/css">

#flotante
{
float:left
position:absolute;
top:0px;
left:0px;
}



</style> 

</head>
<body>
<!--
We use the JS SDK to provide a richer user experience. For more info,
look here: http://github.com/facebook/connect-js
-->
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo $facebook->getAppId(); ?>',
session : <?php echo json_encode($session); ?>, // don't refetch the session when PHP already has it
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});

// whenever the user logs in, we refresh the page
FB.Event.subscribe('auth.login', function() {
window.location.reload();
});
};

(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>


<center>
Estas conectado como:<br>
<a class="uiTooltip fbProfileLink" href="http://www.facebook.com/profile.php?id=<?php echo $uid?>" target="_blank">
<img src="https://graph.facebook.com/<?php echo $uid?>/picture" alt="<?php echo $me['name']; ?>" width="30" height="30">
<span class="uiTooltipWrap top right righttop"><span class="uiTooltipText"><?php echo $me['name']; ?></span></span>
</a>
<div id="flotante"><?php echo $me['name']; ?></div>
</center>

</body>
</html>
ese lo saque de alli mismo del developers de facebook y lo adapte a mi necesidad, lo que hace es decir

Estas conectado como:
FOTO
nombre
__________________
<?php echo "No te metas a lo hondo del Mar si no sabes nadar, primero aprende a nadar" ?>
...Error en linea: 1 o.O