Skip to content

Instantly share code, notes, and snippets.

@brandwaffle
Created September 27, 2011 00:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brandwaffle/1243846 to your computer and use it in GitHub Desktop.
Save brandwaffle/1243846 to your computer and use it in GitHub Desktop.
facebook data retrieval
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head prefix="og: http://ogp.me/ns# brandwaffel:
http://ogp.me/ns/apps/brandwaffel#">
<meta property="fb:app_id" content="164019983683858" />
<meta property="og:type" content="brandwaffel:the_noid" />
<meta property="og:title" content="the Noid" />
<meta property="og:image" content="http://brandwaffle.info/facebook/noid.gif" />
<meta property="og:description" content="Can you do it?" />
<meta property="og:url" content="http://brandwaffle.info/facebook/index.php">
</head>
<h1>Wanna see some PI?</h1>
<table>
<tr>
<td>
<div id="fb-root"></div>
<form>
<input style="font-size: 36px;" type="button" value="Show me!" onclick="avoidNoid()" />
</form>
</td><td>
<fb:add-to-timeline></fb:add-to-timeline>
<div style="margin-top: 20px; margin-left: 200px;"><fb:login-button></fb:login-button></div>
</td>
</tr>
<tr>
<td>
<fb:activity actions="brandwaffel:avoid"></fb:activity>
</td>
</tr>
</table>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script>
function avoidNoid()
{
/*
FB.api('/me/brandwaffel:avoid' +
'?the_noid=http://brandwaffle.info/facebook','post',
function(response) {
if (!response || response.error) {
console.log(response);
} else {
alert('Post was successful! Action ID: ' + response.id);
}
});
*/
/*
FB.ui({
client_id: '164019983683858',
method: 'oauth',
scope: 'read_stream',
redirect_url: 'http://brandwaffle.info/facebook',
response_type: 'token'
},
function(response){
});*/
FB.login(function(response) {
if(response.authResponse){
FB.api('/me/likes' +
'?access_token=' + response.authResponse.accessToken,
function(response) {
if(!response || response.error) {
console.log(response);
} else {
$('body').append('<h1>Stuff I, like, Like</h1><div id="like"></div>');
for(var i=0, l=response.data.length; i<l; i++) {
FB.api(response.data[i].id,
function(like) {
$('#like').append('Like: ' + like.link + '<br />');
});
}
}
});
FB.api('/me/links' +
'?access_token=' + response.authResponse.accessToken + '&limit=100',
function(response) {
if(!response || response.error) {
console.log(response);
} else {
$('body').append('<h1>My Links</h1>');
for (var i=0, l=response.data.length; i<l; i++) {
var link = response.data[i];
if (link.link) {
$('body').append(link.link + '<br />');
}
}
}
});
/* Don't need these now (and you probably have none anyway)
FB.api('/me/friends' +
'?access_token=' + response.authResponse.accessToken,
function(response) {
if(!response || response.error) {
console.log(response);
} else {
$('body').append('<h1>My Friends</h1>');
for (var i=0, l=response.data.length; i<l; i++) {
var user = response.data[i];
if (user.name) {
$('body').append(user.name + '<br />');
}
}
}
});
FB.api('/me/groups' +
'?access_token=' + response.authResponse.accessToken,
function(response) {
if(!response || response.error) {
console.log(response);
} else {
$('body').append('<h1>My Groups</h1>');
for (var i=0, l=response.data.length; i<l; i++) {
var link = response.data[i];
if (link.link) {
$('body').append(link.link + '<br />');
}
}
}
});
FB.api('/me/home' +
'?access_token=' + response.authResponse.accessToken,
function(response) {
if(!response || response.error) {
console.log(response);
} else {
$('body').append('<h1>Links from News Feed</h1>');
for (var i=0, l=response.data.length; i<l; i++) {
var link = response.data[i];
if (link.link) {
$('body').append(link.link + '<br />');
}
}
}
});
*/
}
},
{scope: 'read_stream'}
);
}
$(document).ready(function(){
FB.init({
appId : '164019983683858',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
channelURL : 'http://brandwaffle.info/facebook/channel.html', // channel.html file
oauth : true // enable OAuth 2.0
});
FB.getLoginStatus(function(response){
if(response.authResponse) {
} else {
console.log('who are you?');
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment