anyone knows how to connect and publish on facebook using the api of facebook
anyone knows how to connect and publish on facebook using the api of facebook
Last edited by ing.jose.campo; 2009-12-18 at 14:30.
This example works in the emulator but not in the cellphone
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample Widget</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="basic.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="basic.js"></script>
<meta name="generator" content="Nokia WRT extension for Visual Studio 1.2009.07.29" />
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/XdCommReceiver.js" type="text/javascript"></script>
<script type="text/javascript" src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" ></script>
<script type="text/javascript">
FB_RequireFeatures(["XFBML"], function() {
FB.Facebook.init("XXXXXXXXXXXX", "xd_receiver.htm");
});
</script>
</head>
<body onLoad="init()">
<a href="#" onclick="FB.Connect.requireSession(); return false;" class="fbconnect_login_button FBConnectButton FBConnectButton_Small"> <span id="RES_ID_fb_login_text" class="FBConnectButton_Text">Connect with Facebook</span> </a
</body>
</html>
Note:replace the XXXXXXXXXXXX by the secret api key of your aplication of facebook
I think you should just check the FaceBook API and they developer program, and see how it can be used. And then if you have a problem, just define it well and then somebody might be able to help you.
Hi Symbianyucca,
I found lot questions about connectiong to Facebook using WRT...
On several of the question You answer with "check the FaceBook API and they develop program"...so Yes we all did that before we post and ask help here...
SO,DO YOU HAVE ANSWER ON THIS OR NOT?DID YOU EVER TRY TO CONNECT USING WRT TO FACEBOOK ?
So did you check what API they are using, basically this is Forum Nokia Developer Discussion board, we can not know all details of all possible APIs other service providers are offering, as well as Nokia developer offering does not offer any readymade API for utilizing the service emntioned, thus you do need to check what they offer. There are rather many REST services I did try out and added the test apps in our wiki, which you could use as a base, but the actual infomration needed for connecting any service would come from the service itself.
I got stuck @login
the FBlogin button is in IFRAME and apparently has "javascript:window.open" and does not work under WRT environment should have "javascript:widget.openURL"
the FBlogin button works in mobile browser, but not in WRTand the session/cookies are different from browser to WRT
so it won't work to login in a browser and the WRT app would see you logged in
keep looking for a solution..
the only solution that I have is for example to "connect to facebook" only my top from games... although the top will open in a browser
Code:<?php define('YOUR_APP_ID', '*********'); define('YOUR_APP_SECRET', '*******************'); function get_facebook_cookie($app_id, $app_secret) { $args = array(); parse_str(trim($_COOKIE['fbs_' . $app_id], '\\"'), $args); ksort($args); $payload = ''; foreach ($args as $key => $value) { if ($key != 'sig') { $payload .= $key . '=' . $value; } } if (md5($payload . $app_secret) != $args['sig']) { return null; } return $args; } $cookie = get_facebook_cookie(YOUR_APP_ID, YOUR_APP_SECRET); $user = json_decode(file_get_contents( 'https://graph.facebook.com/me?access_token=' . $cookie['access_token'])); $friends=file_get_contents( 'https://graph.facebook.com/me/friends?access_token=' . $cookie['access_token']) ?> <html> <body> <?php if ($cookie) { ?> Welcome <?= $user->name ?>(<?= $user->id ?>)<?= $user->id ?> <?= $friends ?> <?php } else { ?> <fb:login-button></fb:login-button> <?php } ?> <div id="fb-root"></div> <script src="http://connect.facebook.net/en_US/all.js"></script> <script> FB.init({appId: '<?= YOUR_APP_ID ?>', status: true, cookie: true, xfbml: true}); FB.Event.subscribe('auth.login', function(response) { window.location.reload(); }); </script> </body> </html>
Last edited by shpe; 2011-11-28 at 09:01.