Posted Sun, 01/20/2008 - 07:28 by metarobert
I spent a bit of time this morning adding to my error handling in BeTwittered. Around 8am there was a bit of a service issue at, I believe, the Twitter server end, but I had no way to confirm it. I was, as my own customer, just getting my own "OOPS, something went wrong" please stand by sort of message. The problem is that I used the PHP file_get_contents() function, which does not return HTTP error codes, and when using Twitters HTTP API, that's key for error handling. To make a long story short: I discovered that, although the function does not return the HTTP status codes, that status DOES get stored in the global variable $http_response_header. Are you geeky enough to want to see how I captured this info? Then read on...