Code

<?php defined('BASEPATH') OR exit('No direct script access allowed');
 
/**
 * Mydate
 *
 *
 * @package		CodeIgniter
 * @subpackage	Rest Server
 * @category	Controller
 * @author		Julien Baudry
 * @link		http://
*/
 
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
require APPPATH.'/libraries/REST_Controller.php';
 
class Mydate extends REST_Controller
{
	function __construct()
    {
        // Construct our parent class
        parent::__construct();
 
        // Configure limits on our controller methods. Ensure
        // you have created the 'limits' table and enabled 'limits'
        // within application/config/rest.php
        $this->methods['today_get']['limit'] = 500; //500 requests per hour per user/key
    }
 
	function QuelJour($parm) {
		$aJour[1]="Lundi";
		$aJour[2]="Mardi";
		$aJour[3]="Mercredi";
		$aJour[4]="Jeudi";
		$aJour[5]="Vendredi";
		$aJour[6]="Samedi";
		$aJour[7]="Dimanche";
		return $aJour[date("w",strtotime($parm))];
	}
 
    function today_get()
    {
        if(!$this->get('jour'))
        {
        	$this->response(NULL, 400);
        }
 
		$jour=$this->QuelJour($this->get('jour'));
 
        if($jour)
        {
            $this->response($jour, 200); // 200 being the HTTP response code
        }
 
        else
        {
            $this->response(array('error' => 'Jour could not be found'), 404);
        }
    }
 
 
}