Skip to content

Instantly share code, notes, and snippets.

@coreymcollins
Created June 13, 2013 15:04
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coreymcollins/bdf2f50afbec0b20c423 to your computer and use it in GitHub Desktop.
Save coreymcollins/bdf2f50afbec0b20c423 to your computer and use it in GitHub Desktop.
<?php
// Add our current post's URL to the end of Twitter's API URL
$twitter_url = file_get_contents( 'http://urls.api.twitter.com/1/urls/count.json?url=' . $url );
// Decode the URL in json
$twitter_shares = json_decode( $twitter_url, true );
// Set our variable
$tweet_count = $twitter_shares['count'];
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment