Call the URL below with the parameters.
https://api.facebook.com/method/fql.query?query=select total_count,like_count,comment_count,share_count,click_count from link_stat where url='http://www.twistimage.com/'&format=json
You can change the format between XML and JSON.
Removing the items from the ‘select ‘ part of the query that you don’t want will probably speed things up too.
Make sure to wrap your URL in single quotes or it will return an error.
Have fun.
Here is how you can get the YouTube Video ID from a URL no matter how many extra parameters get passed along with it.
function getYouTubeIdFromURL($url)
{
$url_string = parse_url($url, PHP_URL_QUERY);
parse_str($url_string, $args);
return isset($args['v']) ? $args['v'] : false;
}
Call it:
$youtube_id = getYouTubeIdFromURL("http://www.youtube.com/watch?v=jhjhkum-kq8&feature=related");
echo $youtube_id;
// jhjhkum-kq8
This function allows you to use the Javascript alert function you know so well in your Facebook canvas app.
Code:
function alert(msg, heading)
{
title = (!heading) ? "Alert" : heading;
new Dialog().showMessage(title, msg);
}
Call:
<script>
alert('Boing');
alert('Mooooo', 'The cow says');
</script>
After 3 hours of trying to find out why my autoloads were not working it came down to the fact that my Sluggable was sluggable. Ahhhhh.
Some lessons learned:
1. Dreamhost’s SSH is PHP4 which made my symfony CLI calls not work.
Fixed by using /usr/local/php5/bin/php symfony cc instead of php symfony cc
2. Installing PHP 5.3 on shared Dreamhost account not as easy as advertised. (was probably not needed afterall)
3.Case Sensitivity is driVING me craZy!
Soon, I’ll post a link to the new site that this was for…
I’ve noticed in user’s code throughout the Facebook forum that they often display their FBML by having to echo the whole section or even worse closing the PHP tags, displaying the FBML and then reopening the PHP (example below)
if (!$session) {
$url=$facebook->getLoginUrl(array('canvas' => 1, 'fbconnect' => 0));
?>
<fb:redirect url="<?= $url ?>" />
<?php
exit;
}
So I thought I would write up a quick function to help this look a little cleaner.
I don’t recommend that you use this in all cases but it’s good to havehandy.
Read more »