In writing a PHP script to download xkcd comics, i incurred errors when trying to get specific comics (as opposed to the latest one). Specifically, pointing file_get_contents at the following url:
inexplicably retrieved the xhtml version of the comic's page on xkcd.com, and not a JSON file. However, if i request the exact same url in my browser, the correct JSON file is downloaded. I'm not sure why this is happening, but i suspect it has something to do with the request headers being sent.
Please help! :S