Created
June 4, 2009 15:31
-
-
Save philsturgeon/123670 to your computer and use it in GitHub Desktop.
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
<?php | |
class Rest_test extends Controller { | |
function __construct() { | |
parent::Controller(); | |
$this->load->library('rest', array('server' => 'http://localhost/codeigniter/index.php/example_api/')); | |
} | |
function user_list() | |
{ | |
$responce = $this->rest->get('users', 'xml'); | |
echo "<pre>"; | |
print_r($responce); | |
echo "</pre>"; | |
echo $this->rest->debug(); | |
} | |
function new_user() | |
{ | |
$responce = $this->rest->post('user/id/25', array( | |
'name'=>'New guy!', 'email' => '[email protected]') | |
); | |
echo "<pre>"; | |
print_r($responce); | |
echo "</pre>"; | |
echo $this->rest->debug(); | |
} | |
function delete_user() | |
{ | |
$responce = $this->rest->delete('user/id/23'); | |
echo "<pre>"; | |
print_r($responce); | |
echo "</pre>"; | |
echo $this->rest->debug(); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment