Posted by Kerry Turner on July 27, 2009
Filed under: How to
I had a nightmare earlier this week trying to show my latest tweets in this WordPress blog. I googled a lot (A LOT) to find some decent information on this without success, so I’m posting this in the hope that it clears things up for anyone else who’s having this problem.
I couldn’t connect to Twitter from my site at all. When I tried using Twitter Tools, I got massive slowdowns and the following scary error message:
Warning: fsockopen() [function.fsockopen]: unable to connect to twitter.com:80 (Connection timed out) in [myURL]/wp-includes/class-snoopy.php on line 1142.
All I wanted to do was grab the RSS feed of my public tweets, so I wasn’t worried about using Twitter Tools specifically. However, no matter how many ways I tried to connect to Twitter – using cURL, or just trying to grab the feed like I would any other RSS feed and parse it with SimplePie – I couldn’t get it to display at all. All I was getting were timeouts or reports that there were no public messages in my feed.
I contacted my host, Dreamhost, and they confirmed what I suspected: the problem is on Twitter’s end. For some reason, Twitter seems to be blocking my IP. I contacted Twitter about this, but am still waiting to hear back (update: September now, still waiting!).
So, long story short, if you’re getting this sort of error repeatedly: chances are that Twitter is blocking your site and you simply can’t connect to it, full stop. It’s probably not the news you were hoping for, but hopefully this little gem will save you hours of trying to fix something that is nothing to do with your code!
I’m still hoping this’ll be resolved eventually, but in the meantime the only way I’ve found to integrate Twitter into my site is to use a middleman: stick your Twitter feed in an aggregator, use a widget hosted on a different site, etc. Not ideal, but does the trick.
3 comments