Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
<?=($a=$argv[1])==859?_:@json_decode(file("https"http://xkcd.com/$a/info.0.json")[0])->alt;
Returns null for 404 and 859
Save as xkcd.php and run with the comic number...
$ php xkcd.php 386
<?=($a=$argv[1])==859?_:@json_decode(file("https://xkcd.com/$a/info.0.json")[0])->alt;
<?=($a=$argv[1])==859?_:@json_decode(file("http://xkcd.com/$a/info.0.json")[0])->alt;
<?=($a=$argv[1])==859?null_:@json_decode(file("https://xkcd.com/$a/info.0.json")[0])->alt;
<?=($a=$argv[1])==859?null:@json_decode(file("https://xkcd.com/$a/info.0.json")[0])->alt;