rest - Can't Get Post Data Codeigniter -


i tried make rest api android app using codeigniter, first don't have trouble using method, parameter data can sent. when came post method, rest api can't header. solution great.

thanks

here url using method:

http://10.34.1.122/a-kit-android/api/cont_a_kit/start_mesin_operasi?id_mesin=10&operasi=1 

here url using post method:

http://10.34.1.122/a-kit-android/api/cont_a_kit/start_mesin_operasi 

header : id_mesin = 10, operasi=1

here controller:

function start_mesin_operasi()     {         $idmesin = $this->input->post("id_mesin");          $data = array(                         'operasi' => $this->input->post("operasi"),                                   );          header('content-type: application/json');         echo 'id mesin: '.$idmesin;         echo json_encode($this->mod_a_kit->start_mesin($idmesin, $data));     } 

and here model:

function start_mesin($id, $data)         {   $this->db->set($data);             $this->db->where('id_mesin', $id);             $this->db->update('m_mesin', $data);                          if ($this->db->affected_rows() == 1){                 $response['status'] = 1;                 $response['message'] = "mesin telah dihidupkan";             }             else{                 $response['status'] = 0;                 $response['message'] = "start mesin gagal";                          }              return $response;         }        


Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -