3rd Time is a Charm
Okay, that failed. I have now left the function.php file alone and instead edited the Twitter Tool plugin itself following this example.
$ch = curl_init("http://api.bit.ly/shorten?format=xml;version=2.0.1&login=USERNAME&
apiKey=APIKEY&longUrl=".get_permalink($post_id)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, 0); $data = curl_exec($ch); curl_close($ch); $xml = new SimpleXmlElement($data, LIBXML_NOCDATA); $bitly = $xml->results->nodeKeyVal->shortUrl; $url = apply_filters('tweet_blog_post_url', $bitly);