Advertisement
Guest User

Overtime Function - PHP

a guest
Sep 15th, 2014
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.16 KB | None | 0 0
  1.  public function addOvertime(){
  2.  
  3.         $_nic = $this->input->post('nic');
  4.         $_ward = $this->input->post('ward');
  5.         $_name = $this->input->post('name');
  6.        
  7.         $_fromdate = $this->input->post('fromdate');
  8.         $_frommonth = $this->input->post('frommonth');
  9.         $_fromyear = $this->input->post('fromyear');
  10.                
  11.         $_todate = $this->input->post('todate');
  12.         $_tomonth = $this->input->post('tomonth');
  13.         $_toyear = $this->input->post('toyear');
  14.        
  15.         $_fromtime = $this->input->post('fromtime');
  16.         $_totime = $this->input->post('totime');
  17.         $_hours = $this->input->post('hours');
  18.         $_fromduration = $this->input->post('fromduration');
  19.         $_toduration = $this->input->post('toduration');
  20.        
  21.    
  22.         $_serviceUrl = "http://localhost:8080/HIS/rest/overtime/insert";
  23.  
  24.  
  25.         $_curl = curl_init($_serviceUrl);
  26.  
  27.         $person = array('nic' => $_nic,
  28.                         'name' => $_name,
  29.                         'ward' => $_ward,
  30.                        
  31.                         'fromdate' => $_fromdate,
  32.                         'frommonth' => $_frommonth,
  33.                         'fromyear' => $_fromyear,
  34.                         'fromtime' => $_fromtime,
  35.                        
  36.                         'todate' => $_todate,
  37.                         'tomonth' => $_tomonth,
  38.                         'toyear' => $_toyear,
  39.                         'totime' => $_totime,
  40.            
  41.                         'hours' => $_hours,
  42.                         'fromduration' => $_fromduration,
  43.                         'toduration' => $_toduration);
  44.        
  45.         $_dataString = json_encode($person);
  46.  
  47.         curl_setopt($_curl, CURLOPT_CUSTOMREQUEST, "POST");
  48.         curl_setopt($_curl, CURLOPT_POSTFIELDS, $_dataString);
  49.         curl_setopt($_curl, CURLOPT_RETURNTRANSFER, true);
  50.         curl_setopt(
  51.                 $_curl, CURLOPT_HTTPHEADER, array(
  52.             'Content-Type: application/json',
  53.             'Content-Length: ' . strlen($_dataString))
  54.         );
  55.  
  56.         $_result = curl_exec($_curl);
  57.         echo $_result;
  58.        
  59.        
  60.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement