[eluser]ridley1012[/eluser]
Hi everyone,
I've recently started using the REST library provided by Phil Sturgeon. It seems relatively straight forward except for the error handling. I've purposely set a controller function to return an error like so:
Code:
<?php
require(APPPATH . 'libraries/REST_Controller.php');
class Settings_api extends REST_Controller {
function settings_get()
{
$this->response(NULL, 404);
}
}
?>
If I go direct to the url it just shows a blank page whereas if i use the following code
Code:
$settings = json_decode(file_get_contents('http://www.example.co.uk/api/settings_api/settings/'));
echo $settings;
I get a very generic message like
Quote:failed to open stream: HTTP request failed! HTTP/1.1 404
I'd like to know if there is a way to return a message instead?