-
Notifications
You must be signed in to change notification settings - Fork 1
/
octodexapi.php
97 lines (81 loc) · 32.5 KB
/
octodexapi.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
if(true)// for quick responses
{
header('Content-Type: application/json');
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
$data = <<<EOD
[{"name":"Vinyltocat","page":"\/vinyltocat","image":"\/images\/vinyltocat.png","author":"Author","number":"139","authorURL":"https:\/\/github.com\/suziejurado","authorAvatar":"https:\/\/github.com\/suziejurado.png"},{"name":"Tentocats","page":"\/tentocat","image":"\/images\/tentocats.jpg","author":"Author","number":"138","authorURL":"https:\/\/github.com\/heyhayhay","authorAvatar":"https:\/\/github.com\/heyhayhay.png"},{"name":"Snowtocat","page":"\/snowtocat","image":"\/images\/snowtocat_final.jpg","author":"Author","number":"137","authorURL":"https:\/\/github.com\/heyhayhay","authorAvatar":"https:\/\/github.com\/heyhayhay.png"},{"name":"Justicetocat","page":"\/justicetocat","image":"\/images\/justicetocat.jpg","author":"Author","number":"136","authorURL":"https:\/\/github.com\/heyhayhay","authorAvatar":"https:\/\/github.com\/heyhayhay.png"},{"name":"Blacktocats","page":"\/blacktocats","image":"\/images\/blacktocats.png","author":"Author","number":"135","authorURL":"https:\/\/github.com\/cameronfoxly","authorAvatar":"https:\/\/github.com\/cameronfoxly.png"},{"name":"Saint Nictocat","page":"\/saint_nictocat","image":"\/images\/saint_nictocat.jpg","author":"Author","number":"134","authorURL":"https:\/\/github.com\/heyhayhay","authorAvatar":"https:\/\/github.com\/heyhayhay.png"},{"name":"Mona Lovelace","page":"\/mona-lovelace","image":"\/images\/mona-lovelace.jpg","author":"Author","number":"133","authorURL":"https:\/\/github.com\/heyhayhay","authorAvatar":"https:\/\/github.com\/heyhayhay.png"},{"name":"Dinotocat","page":"\/dinotocat","image":"\/images\/dinotocat.png","author":"Author","number":"132","authorURL":"https:\/\/github.com\/kimestoesta","authorAvatar":"https:\/\/github.com\/kimestoesta.png"},{"name":"Benjamin Bannekat","page":"\/bannekat","image":"\/images\/bannekat.png","author":"Author","number":"131","authorURL":"https:\/\/github.com\/heyhayhay","authorAvatar":"https:\/\/github.com\/heyhayhay.png"},{"name":"Catstello","page":"\/catstello","image":"\/images\/catstello.png","author":"Author","number":"130","authorURL":"https:\/\/github.com\/tonyjaramillo","authorAvatar":"https:\/\/github.com\/tonyjaramillo.png"},{"name":"McEfeeline","page":"\/mcefeeline","image":"\/images\/mcefeeline.jpg","author":"Author","number":"129","authorURL":"https:\/\/github.com\/tonyjaramillo","authorAvatar":"https:\/\/github.com\/tonyjaramillo.png"},{"name":"Skatetocat","page":"\/skatetocat","image":"\/images\/skatetocat.png","author":"Author","number":"128","authorURL":"https:\/\/github.com\/suziejurado","authorAvatar":"https:\/\/github.com\/suziejurado.png"},{"name":"Bewitchedtocat","page":"\/bewitchedtocat","image":"\/images\/bewitchedtocat.jpg","author":"Author","number":"127","authorURL":"https:\/\/github.com\/heyhayhay","authorAvatar":"https:\/\/github.com\/heyhayhay.png"},{"name":"Inflatocat","page":"\/inflatocat","image":"\/images\/inflatocat.png","author":"Author","number":"126","authorURL":"https:\/\/github.com\/rubyjazzy","authorAvatar":"https:\/\/github.com\/rubyjazzy.png"},{"name":"Hanukkat","page":"\/hanukkat","image":"\/images\/hanukkat.png","author":"Author","number":"125","authorURL":"https:\/\/github.com\/tonyjaramillo","authorAvatar":"https:\/\/github.com\/tonyjaramillo.png"},{"name":"Welcometocat","page":"\/welcometocat","image":"\/images\/welcometocat.png","author":"Author","number":"124","authorURL":"https:\/\/github.com\/jglovier","authorAvatar":"https:\/\/github.com\/jglovier.png"},{"name":"Filmtocat","page":"\/filmtocat","image":"\/images\/filmtocat.png","author":"Author","number":"123","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Private Investocat","page":"\/privateinvestocat","image":"\/images\/privateinvestocat.jpg","author":"Author","number":"122","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Gracehoppertocat","page":"\/gracehoppertocat","image":"\/images\/gracehoppertocat.jpg","author":"Author","number":"121","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Gobble-o-tron","page":"\/gobbleotron","image":"\/images\/gobbleotron.gif","author":"Author","number":"120","authorURL":"https:\/\/github.com\/JohnCreek","authorAvatar":"https:\/\/github.com\/JohnCreek.png"},{"name":"Jetpacktocat","page":"\/jetpacktocat","image":"\/images\/jetpacktocat.png","author":"Author","number":"119","authorURL":"https:\/\/github.com\/tonyjaramillo","authorAvatar":"https:\/\/github.com\/tonyjaramillo.png"},{"name":"Minertocat","page":"\/minertocat","image":"\/images\/minertocat.png","author":"Author","number":"118","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Mountietocat","page":"\/mountietocat","image":"\/images\/mountietocat.png","author":"Author","number":"117","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Saketocat","page":"\/saketocat","image":"\/images\/saketocat.png","author":"Author","number":"116","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Luchadortocat","page":"\/luchadortocat","image":"\/images\/luchadortocat.png","author":"Author","number":"115","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Saritocat","page":"\/saritocat","image":"\/images\/saritocat.png","author":"Author","number":"114","authorURL":"https:\/\/github.com\/JohnCreek","authorAvatar":"https:\/\/github.com\/JohnCreek.png"},{"name":"Topguntocat","page":"\/topguntocat","image":"\/images\/topguntocat.png","author":"Author","number":"113","authorURL":"https:\/\/github.com\/leereilly","authorAvatar":"https:\/\/github.com\/leereilly.png"},{"name":"Carlostocat","page":"\/carlostocat","image":"\/images\/carlostocat.gif","author":"Author","number":"112","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Grinchtocat","page":"\/grinchtocat","image":"\/images\/grinchtocat.gif","author":"Author","number":"111","authorURL":"https:\/\/github.com\/tonyjaramillo","authorAvatar":"https:\/\/github.com\/tonyjaramillo.png"},{"name":"Maxtocat","page":"\/maxtocat","image":"\/images\/maxtocat.gif","author":"Author","number":"110","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Yaktocat","page":"\/yaktocat","image":"\/images\/yaktocat.png","author":"Author","number":"109","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Steroidtocat","page":"\/steroidtocat","image":"\/images\/steroidtocat.png","author":"Author","number":"108","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Mummytocat","page":"\/mummytocat","image":"\/images\/mummytocat.gif","author":"Author","number":"107","authorURL":"https:\/\/github.com\/tonyjaramillo","authorAvatar":"https:\/\/github.com\/tonyjaramillo.png"},{"name":"Labtocat","page":"\/labtocat","image":"\/images\/labtocat.png","author":"Author","number":"106","authorURL":"https:\/\/github.com\/JohnCreek","authorAvatar":"https:\/\/github.com\/JohnCreek.png"},{"name":"Dunetocat","page":"\/dunetocat","image":"\/images\/dunetocat.png","author":"Author","number":"105","authorURL":"https:\/\/github.com\/JohnCreek","authorAvatar":"https:\/\/github.com\/JohnCreek.png"},{"name":"OctoLiberty","page":"\/octoliberty","image":"\/images\/octoliberty.png","author":"Author","number":"104","authorURL":"https:\/\/github.com\/tonyjaramillo","authorAvatar":"https:\/\/github.com\/tonyjaramillo.png"},{"name":"Femalecodertocat","page":"\/femalecodertocat","image":"\/images\/femalecodertocat.png","author":"Author","number":"103","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Daftpunktocat-Thomas","page":"\/daftpunktocat-thomas","image":"\/images\/daftpunktocat-thomas.gif","author":"Author","number":"102","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Daftpunktocat-Guy","page":"\/daftpunktocat-guy","image":"\/images\/daftpunktocat-guy.gif","author":"Author","number":"101","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Founding Father v2","page":"\/foundingfather_v2","image":"\/images\/foundingfather_v2.png","author":"Author","number":"100","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Poptocat v2","page":"\/poptocat_v2","image":"\/images\/poptocat_v2.png","author":"Author","number":"99","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Mardigrastocat","page":"\/Mardigrastocat","image":"\/images\/Mardigrastocat.png","author":"Author","number":"98","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Kimonotocat","page":"\/Kimonotocat","image":"\/images\/kimonotocat.png","author":"Author","number":"97","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"professortocat_v2","page":"\/Professortocat_v2","image":"\/images\/Professortocat_v2.png","author":"Author","number":"96","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"goretocat","page":"\/goretocat","image":"\/images\/goretocat.png","author":"Author","number":"95","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Robotocat","page":"\/Robotocat","image":"\/images\/Robotocat.png","author":"Author","number":"94","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Motherhubbertocat","page":"\/motherhubbertocat","image":"\/images\/motherhubbertocat.png","author":"Author","number":"93","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Skitchtocat","page":"\/skitchtocat","image":"\/images\/skitchtocat.png","author":"Author","number":"92","authorURL":"https:\/\/github.com\/jonrohan","authorAvatar":"https:\/\/github.com\/jonrohan.png"},{"name":"Gangnamtocat","page":"\/gangnamtocat","image":"\/images\/gangnamtocat.png","author":"Author","number":"91","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Dr.Octocat","page":"\/droctocat","image":"\/images\/droctocat.png","author":"Author","number":"90","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Spidertocat","page":"\/spidertocat","image":"\/images\/spidertocat.png","author":"Author","number":"89","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Megacat v2","page":"\/megacat-2","image":"\/images\/megacat-2.png","author":"Author","number":"88","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Dodgetocat v2","page":"\/dodgetocat-v2","image":"\/images\/dodgetocat_v2.png","author":"Author","number":"87","authorURL":"https:\/\/github.com\/tonyjaramillo","authorAvatar":"https:\/\/github.com\/tonyjaramillo.png"},{"name":"Stormtroopocat","page":"\/stormtroopocat","image":"\/images\/stormtroopocat.png","author":"Author","number":"86","authorURL":"https:\/\/github.com\/jeejkang","authorAvatar":"https:\/\/github.com\/jeejkang.png"},{"name":"Pusheencat","page":"\/pusheencat","image":"\/images\/pusheencat.png","author":"Author","number":"85","authorURL":"https:\/\/github.com\/billyroh","authorAvatar":"https:\/\/github.com\/billyroh.png"},{"name":"Deckfailcat","page":"\/deckfailcat","image":"\/images\/deckfailcat.png","author":"Author","number":"84","authorURL":"https:\/\/github.com\/mattgraham","authorAvatar":"https:\/\/github.com\/mattgraham.png"},{"name":"Murakamicat","page":"\/murakamicat","image":"\/images\/murakamicat.png","author":"Author","number":"83","authorURL":"https:\/\/github.com\/billyroh","authorAvatar":"https:\/\/github.com\/billyroh.png"},{"name":"Homercat","page":"\/homercat","image":"\/images\/homercat.png","author":"Author","number":"82","authorURL":"https:\/\/github.com\/nickh","authorAvatar":"https:\/\/github.com\/nickh.png"},{"name":"Minion","page":"\/minion","image":"\/images\/minion.png","author":"Author","number":"81","authorURL":"https:\/\/github.com\/nickh","authorAvatar":"https:\/\/github.com\/nickh.png"},{"name":"Droidtocat","page":"\/droidtocat","image":"\/images\/droidtocat.png","author":"Author","number":"80","authorURL":"https:\/\/github.com\/tonyjaramillo","authorAvatar":"https:\/\/github.com\/tonyjaramillo.png"},{"name":"Octofez","page":"\/octofez","image":"\/images\/octofez.png","author":"Author","number":"79","authorURL":"https:\/\/github.com\/nickh","authorAvatar":"https:\/\/github.com\/nickh.png"},{"name":"Heisencat","page":"\/heisencat","image":"\/images\/heisencat.png","author":"Author","number":"78","authorURL":"https:\/\/github.com\/jonrohan","authorAvatar":"https:\/\/github.com\/jonrohan.png"},{"name":"Red Polo","page":"\/red-polo","image":"\/images\/red-polo.png","author":"Author","number":"77","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"20% Cooler Octocat","page":"\/twenty-percent-cooler-octocat","image":"\/images\/twenty-percent-cooler-octocat.png","author":"Author","number":"76","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Momtocat","page":"\/momtocat","image":"\/images\/momtocat.png","author":"Author","number":"75","authorURL":"https:\/\/github.com\/tonyjaramillo","authorAvatar":"https:\/\/github.com\/tonyjaramillo.png"},{"name":"Front-End Conftocat","page":"\/front-end-conftocat","image":"\/images\/front-end-conftocat.png","author":"Author","number":"74","authorURL":"https:\/\/github.com\/tonyjaramillo","authorAvatar":"https:\/\/github.com\/tonyjaramillo.png"},{"name":"Snow Octocat","page":"\/snowoctocat","image":"\/images\/snowoctocat.png","author":"Author","number":"73","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Electrocat","page":"\/electrocat","image":"\/images\/electrocat.png","author":"Author","number":"72","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Codercat","page":"\/codercat","image":"\/images\/codercat.jpg","author":"Author","number":"71","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Strongbadtocat","page":"\/strongbadtocat","image":"\/images\/strongbadtocat.png","author":"Author","number":"70","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Adventure Cat","page":"\/adventure-cat","image":"\/images\/adventure-cat.png","author":"Author","number":"69","authorURL":"https:\/\/github.com\/jonrohan","authorAvatar":"https:\/\/github.com\/jonrohan.png"},{"name":"Doctocat Brown","page":"\/doctocat-brown","image":"\/images\/doctocat-brown.jpg","author":"Author","number":"68","authorURL":"https:\/\/github.com\/jonrohan","authorAvatar":"https:\/\/github.com\/jonrohan.png"},{"name":"Dojocat","page":"\/dojocat","image":"\/images\/dojocat.jpg","author":"Author","number":"67","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Defunktocat","page":"\/defunktocat","image":"\/images\/defunktocat.png","author":"Author","number":"66","authorURL":"https:\/\/github.com\/jasoncostello","authorAvatar":"https:\/\/github.com\/jasoncostello.png"},{"name":"Nemesis","page":"\/nemesis","image":"\/images\/herme-t-crabb.png","author":"Author","number":"65","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Saint Nicktocat","page":"\/saint-nicktocat","image":"\/images\/saint-nicktocat.jpg","author":"Author","number":"64","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Ordered Listocat","page":"\/orderedlistocat","image":"\/images\/orderedlistocat.png","author":"Author","number":"63","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Thanktocat","page":"\/thanktocat","image":"\/images\/thanktocat.png","author":"Author","number":"62","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Megacat","page":"\/megacat","image":"\/images\/megacat.jpg","author":"Author","number":"61","authorURL":"https:\/\/github.com\/jasoncostello","authorAvatar":"https:\/\/github.com\/jasoncostello.png"},{"name":"Linktocat","page":"\/linktocat","image":"\/images\/linktocat.jpg","author":"Author","number":"60","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Plumber","page":"\/plumber","image":"\/images\/plumber.jpg","author":"Author","number":"59","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Octotron","page":"\/octotron","image":"\/images\/octotron.jpg","author":"Author","number":"58","authorURL":"https:\/\/github.com\/broccolini","authorAvatar":"https:\/\/github.com\/broccolini.png"},{"name":"Baracktocat","page":"\/baracktocat","image":"\/images\/baracktocat.jpg","author":"Author","number":"57","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Octocat De Los Muertos","page":"\/octocat-de-los-muertos","image":"\/images\/octocat-de-los-muertos.jpg","author":"Author","number":"56","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Grim Repo","page":"\/grim-repo","image":"\/images\/grim-repo.jpg","author":"Author","number":"55","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Father Timeout","page":"\/father-timeout","image":"\/images\/father_timeout.jpg","author":"Author","number":"54","authorURL":"https:\/\/github.com\/jasoncostello","authorAvatar":"https:\/\/github.com\/jasoncostello.png"},{"name":"Where's Waldocat","page":"\/wheres-waldocat","image":"\/images\/waldocat.png","author":"Author","number":"53","authorURL":"https:\/\/github.com\/jasoncostello","authorAvatar":"https:\/\/github.com\/jasoncostello.png"},{"name":"Hipster Partycat","page":"\/hipster-partycat","image":"\/images\/hipster-partycat.jpg","author":"Author","number":"52","authorURL":"https:\/\/github.com\/jina","authorAvatar":"https:\/\/github.com\/jina.png"},{"name":"Riddlocat","page":"\/riddlocat","image":"\/images\/riddlocat.png","author":"Author","number":"51","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Visionary","page":"\/visionary","image":"\/images\/visionary.jpg","author":"Author","number":"50","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Oktobercat","page":"\/oktobercat","image":"\/images\/oktobercat.png","author":"Author","number":"49","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Shoptocat","page":"\/shoptocat","image":"\/images\/shoptocat.png","author":"Author","number":"48","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Nyantocat","page":"\/nyantocat","image":"\/images\/nyantocat.gif","author":"Author","number":"47","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Octdrey Catburn","page":"\/octdrey-catburn","image":"\/images\/octdrey-catburn.jpg","author":"Author","number":"46","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Spectrocat","page":"\/spectrocat","image":"\/images\/spectrocat.png","author":"Author","number":"45","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Bear Cavalry","page":"\/bear-cavalry","image":"\/images\/bear-cavalry.png","author":"Author","number":"44","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Andycat","page":"\/andycat","image":"\/images\/andycat.jpg","author":"Author","number":"43","authorURL":"https:\/\/github.com\/jasoncostello","authorAvatar":"https:\/\/github.com\/jasoncostello.png"},{"name":"Not Octocat","page":"\/notocat","image":"\/images\/notocat.jpg","author":"Author","number":"42","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Dodge, Duck, Dip, Dive, Dodgetocat","page":"\/dodgetocat","image":"\/images\/dodgetocat.jpg","author":"Author","number":"41","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Cloud","page":"\/cloud","image":"\/images\/cloud.jpg","author":"Author","number":"40","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Scarletteocat","page":"\/scarletteocat","image":"\/images\/scarletteocat.jpg","author":"Author","number":"39","authorURL":"https:\/\/github.com\/jordanmccullough","authorAvatar":"https:\/\/github.com\/jordanmccullough.png"},{"name":"Poptocat","page":"\/poptocat","image":"\/images\/poptocat.png","author":"Author","number":"38","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Jenktocat","page":"\/jenktocat","image":"\/images\/jenktocat.jpg","author":"Author","number":"37","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"X-tocat","page":"\/xtocat","image":"\/images\/xtocat.jpg","author":"Author","number":"36","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Chellocat","page":"\/chellocat","image":"\/images\/chellocat.jpg","author":"Author","number":"35","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Cherryontop-o-cat","page":"\/cherryontop-o-cat","image":"\/images\/cherryontop-o-cat.png","author":"Author","number":"34","authorURL":"https:\/\/github.com\/jasoncostello","authorAvatar":"https:\/\/github.com\/jasoncostello.png"},{"name":"Supportcat","page":"\/supportcat","image":"\/images\/supportcat.png","author":"Author","number":"33","authorURL":"https:\/\/github.com\/jasoncostello","authorAvatar":"https:\/\/github.com\/jasoncostello.png"},{"name":"Collabocats","page":"\/collabocats","image":"\/images\/collabocats.jpg","author":"Author","number":"32","authorURL":"https:\/\/github.com\/jasoncostello","authorAvatar":"https:\/\/github.com\/jasoncostello.png"},{"name":"Constructocat","page":"\/constructocat-v2","image":"\/images\/constructocat2.jpg","author":"Author","number":"31","authorURL":"https:\/\/github.com\/jasoncostello","authorAvatar":"https:\/\/github.com\/jasoncostello.png"},{"name":"Total Eclipse of the Octocat","page":"\/total-eclipse-of-the-octocat","image":"\/images\/total-eclipse-of-the-octocat.jpg","author":"Author","number":"30","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Blinktocat, Pinktocat, Inktocat, and Clyde","page":"\/pacman-ghosts","image":"\/images\/pacman-ghosts.jpg","author":"Author","number":"29","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Okal-Eltocat","page":"\/okal-eltocat","image":"\/images\/okal-eltocat.jpg","author":"Author","number":"28","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Octoclark Kentocat","page":"\/octoclarkkentocat","image":"\/images\/octoclark-kentocat.jpg","author":"Author","number":"27","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Agendacat","page":"\/agendacat","image":"\/images\/agendacat.png","author":"Author","number":"26","authorURL":"https:\/\/github.com\/jasoncostello","authorAvatar":"https:\/\/github.com\/jasoncostello.png"},{"name":"IronCat","page":"\/ironcat","image":"\/images\/ironcat.jpg","author":"Author","number":"25","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Inspectocat","page":"\/inspectocat","image":"\/images\/inspectocat.jpg","author":"Author","number":"24","authorURL":"https:\/\/github.com\/jasoncostello","authorAvatar":"https:\/\/github.com\/jasoncostello.png"},{"name":"Jean-Luc Picat","page":"\/jean-luc-picat","image":"\/images\/jean-luc-picat.jpg","author":"Author","number":"23","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Spocktocat","page":"\/spocktocat","image":"\/images\/spocktocat.png","author":"Author","number":"22","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Wilson","page":"\/wilson","image":"\/images\/wilson.jpg","author":"Author","number":"21","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Swagtocat","page":"\/swagtocat","image":"\/images\/swagtocat.png","author":"Author","number":"20","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Drunktocat","page":"\/drunktocat","image":"\/images\/drunktocat.jpg","author":"Author","number":"19","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Hubot","page":"\/hubot","image":"\/images\/hubot.jpg","author":"Author","number":"18","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Monroe","page":"\/monroe","image":"\/images\/monroe.jpg","author":"Author","number":"17","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Trekkie","page":"\/trekkie","image":"\/images\/trekkie.png","author":"Author","number":"16","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Octonaut","page":"\/octonaut","image":"\/images\/octonaut.jpg","author":"Author","number":"15","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Bouncer","page":"\/bouncer","image":"\/images\/bouncercat.png","author":"Author","number":"14","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Founding Father","page":"\/founding-father","image":"\/images\/founding-father.jpg","author":"Author","number":"13","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Pythocat","page":"\/pythocat","image":"\/images\/pythocat.png","author":"Author","number":"12","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Drupalcat","page":"\/drupalcat","image":"\/images\/drupalcat.jpg","author":"Author","number":"11","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Socialite","page":"\/socialite","image":"\/images\/socialite.jpg","author":"Author","number":"10","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Setuptocat","page":"\/setuptocat","image":"\/images\/setuptocat.jpg","author":"Author","number":"9","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Repo","page":"\/repo","image":"\/images\/repo.png","author":"Author","number":"8","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Forktocat","page":"\/forktocat","image":"\/images\/forktocat.jpg","author":"Author","number":"7","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Benevocats","page":"\/benevocats","image":"\/images\/benevocats.png","author":"Author","number":"6","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Scottocat","page":"\/scottocat","image":"\/images\/scottocat.jpg","author":"Author","number":"5","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Puppeteer","page":"\/puppeteer","image":"\/images\/puppeteer.png","author":"Author","number":"4","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Octobi Wan Catnobi","page":"\/octobiwan","image":"\/images\/octobiwan.jpg","author":"Author","number":"3","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Class Act","page":"\/class-act","image":"\/images\/class-act.png","author":"Author","number":"2","authorURL":"https:\/\/github.com\/cameronmcefee","authorAvatar":"https:\/\/github.com\/cameronmcefee.png"},{"name":"Original","page":"\/original","image":"\/images\/original.png","author":"","number":"1","authorURL":"http:\/\/www.idokungfoo.com","authorAvatar":"\/images\/idokungfoo-avatar.jpg"}]
EOD;
echo $data;
return;
}
header('Content-Type: application/json');
$dom = new DOMDocument();
@$dom->loadHTMLFile('http://octodex.github.com/');
$xpath = new DOMXpath($dom);
$elements = $xpath->query("//*/div[@class='item-shell']");
if(!is_null($elements))
{
$octodex = array();
foreach ($elements as $element) {
$octocat = array();
$tempDom = new DOMDocument();
$tempDom->appendChild($tempDom->importNode($element, true));
$tempDom->saveHTML();
$links = $tempDom->getElementsByTagName('a');
$images = $tempDom->getElementsByTagName('img');
$octocatName = $links->item(2)->nodeValue;
$octocatPage = $links->item(1)->getAttribute('href');
$octocatImage = $images->item(0)->getAttribute('data-src');
$octocatAuthor = $images->item(1)->getAttribute('alt');
$octocatNumber = $tempDom->getElementsByTagName('p')->item(0)->nodeValue;
$octocatAuthorURL = $links->item(3)->getAttribute('href');
$octocatAuthorAvatar = $images->item(1)->getAttribute('src');
$octocat['name'] = $octocatName;
$octocat['page'] = $octocatPage;
$octocat['image'] = $octocatImage;
$octocat['author'] = $octocatAuthor;
$octocat['number'] = str_replace('#', '', $octocatNumber);
$octocat['authorURL'] = $octocatAuthorURL;
$octocat['authorAvatar'] = $octocatAuthorAvatar;
/*
This is to remove all of the parameters passed to Gravatar, but I don't think that's necessary, as it gives a pretty big image...
$octocat['authorAvatar'] = substr($octocatAuthorAvatar, 0, strpos($octocatAuthorAvatar,'?'));
*/
$octodex[] = $octocat;
// var_dump($dom->saveHTML($element));
}
}
if (array_key_exists('random', $_GET)) {
if (array_key_exists('number', $_GET)) {
echo json_encode(array("error" => "Can not provide random and numbered Octocat..."));
}
else {
// Though this is not the most efficient way to grab a random octocat, it is not significantly slower, so I'll leave it for the time being...
echo json_encode($octodex[array_rand($octodex)]);
}
}
else if (array_key_exists('number', $_GET)) {
if (array_key_exists('random', $_GET)) {
echo json_encode(array("error" => "Can not provide random and numbered Octocat..."));
}
else {
if (!empty($_GET['number'])) {
if ($_GET['number'] <= count($octodex)) {
// Though this is not the most efficient way to grab a numbered octocat, it is not significantly slower, so I'll leave it for the time being...
foreach ($octodex as $octocat) {
if ($octocat['number'] == $_GET['number']) {
echo json_encode($octocat);
exit();
}
else continue;
}
}
else echo json_encode(array("error" => "Octocat numbered ".$_GET['number']." does not exist!"));
}
else echo json_encode(array("error" => "Please pass a number for an Octocat..."));
}
}
else echo json_encode($octodex);