Why Your Twitter Links Stopped Working
I have been working on some code for a site that’s integrating a lot of social media links, and everything was going swimmingly until I noticed that the “Post to Twitter links were no longer working.
It turns out Twitter has made a few changes, but the fix was very easy.
All that was required to fix up the links was to replace instances of
http://twitter.com/home?status=
with
http://twitter.com/intent/tweet?text=
So.. begin with a call to the twitter javascript, so that your links will pop up in a nice neat window:
<script type=”text/javascript” src=”http://platform.twitter.com/widgets.js”></script>
Then, if you’re using PHP, you’ll want to get the variable that defines the current page:
<?php $pageURL = $_SERVER["SERVER_NAME"].
$_SERVER["REQUEST_URI"]; ?>
And then finally, you can put that variable into your twitter link:
<a href=”http://twitter.com/intent/tweet?text=your+text+here+http%3A%2F%2F<?php echo $pageURL; ?>”>
And, YAY! It works.

