If it works on your localhost but not on your public host, then chances are that Twitter is either blocking or throttling your public server's IP. Many shared hosts get blocked/throttled because there are multiple sites banging away at the Twitter API without authentication. Twitter views them as one app and throttles the IP as a whole.
To get around this, you're going to need to authenticate using oAuth. It's a pain in the ass, but it's a necessary step. Here are some resources that you might find to be handy:
Twitter offers you some credentials in the "Your Apps" section of the Twitter Developer website. Once you've registered your site as an app, click on My Access Token. That will give you a key/token that you can use to successfully authenticate.
Another thought is that Twitter is simply throttling your app. If this is the case, it's because you've got too much traffic and you're not caching the API results. Cache the results of the API for, say, an hour before fetching a new copy. Twitter will stop singling you out if you do this.
if(filemtime("cache.xml") < (int)$_SERVER["REQUEST_TIME"] - 3600) {
$data = file_get_contents("http://twitter.com/users/show.xml?screen_name=username");
file_put_contents("cache.xml", $data);
} else
$data = file_get_contents("cache.xml");