I am developing an API using Phils RestServer and I need to validate incoming PUT data. It works fine with incoming POST data but not PUT.
How can I validate data that are sent via PUT?
Thankful for all input!
Nope! Doesn't work. What you CAN do is hack it, so:
$_POST['foo'] = $this->put('foo');
Allowing the CodeIgniter Form Validation class to validate things other than POST is on the todo list (for exactly this reason).
Here is my solution. I am using set_data() function from form validation library:
$set_data = array(
'username' => $this->put('username'),
'email' => $this->put('email'),
'zipcode' => $this->put('zipcode'),
'telephone' => $this->put('telephone'),
'password' => $this->put('password'),
);
$this->form_validation->set_data($set_data);
$this->form_validation->set_rules($this->Register_model->rules_register);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With