Created
October 28, 2011 16:55
-
-
Save charliewilson/1322759 to your computer and use it in GitHub Desktop.
kickpushlib - A PHP library for the KickPush JSON API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
//kickpushlib version 1.0.1 | |
//A PHP library for the KickPush JSON API | |
//by Charlie Wilson | |
//Gets spot data from it's ID | |
function kp_SpotByID($id) | |
{ | |
//Reads the response from the JSON API | |
$response = file_get_contents("http://www.kickpush.info/api/json_spot_byid.php?id=" . $id); | |
//Decodes the JSON to an array | |
$returnstring = json_decode($response, true); | |
//Returns the data | |
return $returnstring; | |
} | |
//Gets spot data from it's name | |
function kp_SpotByName($name) | |
{ | |
//Reads the response from the JSON API, encoding spaces in the name | |
$response = file_get_contents("http://www.kickpush.info/api/json_spot_byname.php?id=" . urlencode($name)); | |
//Decodes the JSON to an array | |
$returnstring = json_decode($response, true); | |
//Returns the data | |
return $returnstring; | |
} | |
//Gets user data from their username | |
function kp_UserByUsername($username) | |
{ | |
//Reads the response from the JSON API, encoding the username for non-standard characters | |
$response = file_get_contents("http://www.kickpush.info/api/json_user_byusername.php?id=" . urlencode($username)); | |
//Decodes the JSON to an array | |
$returnstring = json_decode($response, true); | |
//Returns the data | |
return $returnstring; | |
} | |
//Gets user data from their full name | |
function kp_UserByFullname($fullname) | |
{ | |
//Reads the response from the JSON API, encoding spaces in the name | |
$response = file_get_contents("http://www.kickpush.info/api/json_user_byfullname.php?id=" . urlencode($fullname)); | |
//Decodes the JSON to an array | |
$returnstring = json_decode($response, true); | |
//Returns the data | |
return $returnstring; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment