====== Solution Restful WS ======
===== View =====
load->helper(array('form', 'url'));
$this->load->view("myapp");
}
}
?>
My Form
Username
Date
===== Controller =====
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 day_get()
{
if(!$this->get('jj-mm-yyyy'))
{
$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);
}
}
function day_post()
{
//$this->some_model->updateDate( $this->post('date') );
$message = array('username' => $this->post('username'), 'date' => $this->post('date'), 'res' => $this->QuelJour($this->post('date')), 'message' => 'ADDED IN DATABASE!');
$this->response($message, 200); // 200 being the HTTP response code
}
}