Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function addOvertime(){
- $_nic = $this->input->post('nic');
- $_ward = $this->input->post('ward');
- $_name = $this->input->post('name');
- $_fromdate = $this->input->post('fromdate');
- $_frommonth = $this->input->post('frommonth');
- $_fromyear = $this->input->post('fromyear');
- $_todate = $this->input->post('todate');
- $_tomonth = $this->input->post('tomonth');
- $_toyear = $this->input->post('toyear');
- $_fromtime = $this->input->post('fromtime');
- $_totime = $this->input->post('totime');
- $_hours = $this->input->post('hours');
- $_fromduration = $this->input->post('fromduration');
- $_toduration = $this->input->post('toduration');
- $_serviceUrl = "http://localhost:8080/HIS/rest/overtime/insert";
- $_curl = curl_init($_serviceUrl);
- $person = array('nic' => $_nic,
- 'name' => $_name,
- 'ward' => $_ward,
- 'fromdate' => $_fromdate,
- 'frommonth' => $_frommonth,
- 'fromyear' => $_fromyear,
- 'fromtime' => $_fromtime,
- 'todate' => $_todate,
- 'tomonth' => $_tomonth,
- 'toyear' => $_toyear,
- 'totime' => $_totime,
- 'hours' => $_hours,
- 'fromduration' => $_fromduration,
- 'toduration' => $_toduration);
- $_dataString = json_encode($person);
- curl_setopt($_curl, CURLOPT_CUSTOMREQUEST, "POST");
- curl_setopt($_curl, CURLOPT_POSTFIELDS, $_dataString);
- curl_setopt($_curl, CURLOPT_RETURNTRANSFER, true);
- curl_setopt(
- $_curl, CURLOPT_HTTPHEADER, array(
- 'Content-Type: application/json',
- 'Content-Length: ' . strlen($_dataString))
- );
- $_result = curl_exec($_curl);
- echo $_result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement