Skip to content

Instantly share code, notes, and snippets.

@philsturgeon
Created June 4, 2009 15:31
Show Gist options
  • Save philsturgeon/123670 to your computer and use it in GitHub Desktop.
Save philsturgeon/123670 to your computer and use it in GitHub Desktop.
<?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