frobak Posted February 27, 2018 Share Posted February 27, 2018 (edited) I've got a bit of a strange one here, Ive got posted data that seems to be reaching the server, but isn't available to the post array. I am posting data from an API to my server which is a codeigniter install. On the server I am simply collecting the posted data and dumping, so that I can see whats coming in. Here's the code in the controller to dump the posted data (simple stuff) : $data = array ( 'email' => $this->input->post('email'), 'password' => $this->input->post('password') ); var_dump($data); And when I use postman to test this, it works and I get this returned, which is what I expect, and tells me its not anything on the server that is preventing the posted data from being available: array(2) { ["email"]=> string(5) "alans" ["password"]=> string(4) "pass" } So all good! NOW When trying this from my API, the variables are empty, even though they are being posted to the server, when inspecting the the network via the browser console. I have added an image from the browser console, which clearly shows the data being posted as Form Data and the content type: application/x-www-form-urlencoded. (note: I have added the vars to the query string, headers and Form data, none of them are available from the server) SO, my question is, how is this possible. What could possibly cause the data to somehow go astray? Can you think of anything that would prevent the data being available, bearing in mind using the same variables, posting to the same URL and the same content type via postman. the data arrives? Any help with this would be very much appreciated as after about 15 hours trying everything I could think of I am at a loss. Cheers! Edited February 27, 2018 by frobak Quote Link to comment Share on other sites More sharing options...
requinix Posted February 27, 2018 Share Posted February 27, 2018 Does $_SERVER["REQUEST_METHOD"] say POST? Do you have any web server or PHP security module extension things installed and active? Quote Link to comment Share on other sites More sharing options...
frobak Posted February 27, 2018 Author Share Posted February 27, 2018 dumping $_SERVER["REQUEST_METHOD"] give me: string(4) "POST" No I dont have any security that would affect it. I get the posted data if I use the postman service, which makes me think its not something on the server that is preventing the data, but something to do with the request, or something in the headers?!?!? Quote Link to comment Share on other sites More sharing options...
dalecosp Posted February 27, 2018 Share Posted February 27, 2018 What do you get if you dump $_REQUEST instead of $_POST? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.