Skip to content

Instantly share code, notes, and snippets.

@darkhelmet
Created August 29, 2009 23:42
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 darkhelmet/177761 to your computer and use it in GitHub Desktop.
Save darkhelmet/177761 to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Tweet with surl
Plugin URI: http://s.darkhax.com
Description: Use surl with Twitter Tools
Version: 1.0
Author: Daniel Huckstep
Author URI: http://www.darkhax.com
*/
function get_content($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
ob_start();
curl_exec($ch);
curl_close($ch);
$string = ob_get_contents();
ob_end_clean();
return $string;
}
function surl($long_url) {
return get_content("http://s.darkhax.com/?api&unsafe=on&url=".urlencode($long_url));
}
add_filter('tweet_blog_post_url', 'surl');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment