Cookyx's Web API
What is an API? API stands for Application Programming Interface. "A Web API is typically a defined set of HTTP request messages along with a definition of the structure of response messages" - Wikipedia.Cookyx's Web API is nothing fancy. It's just a bunch of words, numbers, and commas -- really. It's so easy to get started. For example... if you go to, http://cookyx.com/cookyxapi.php?id=1 you would get a bunch of words and numbers with comas. You can, of couse, replace the 1 with your member id or another member's ID.
The order of the API stats is simple. Take this HTTP request for example:
3,xxx,1,http://cookyx.com/images/avatars/noavatar.png,Online,1,1,3,3
member id, username, cookies, avatar image link, status, cookies today, cookies this month, overall rank, monthly rank
PHP Example
Here's a PHP example to help you get started.
<?php // Cookyx API v1 // (c) 2008 - 2013
// PHP Example // April 2010 $url = "http://cookyx.com/cookyxapi.php?id="; $id = "1"; // cookyx user id $file = file_get_contents($url.$id); $stat = explode(",", $file); // API DEFINATIONS // $stat[0] - user id // $stat[1] - username // $stat[2] - total cookies // $stat[3] - avatar image link // $stat[4] - login status // $stat[5] - cookies earned today // $stat[6] - cookies earned this month // $stat[7] - overall rank // $stat[8] - monthly rank ?> My username is: <?=$stat[1]?><br /> I have <?=$stat[2]?> cookies<br /> I am currently <?=$stat[4]?> <?php // Insert your PHP code here using the variable arrays. :) ?>