Jump to content
frobak

Post data from API is not reaching the server

Recommended Posts

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!

post-69181-0-50607900-1519743901_thumb.png

Edited by frobak

Share this post


Link to post
Share on other sites

Does $_SERVER["REQUEST_METHOD"] say POST? Do you have any web server or PHP security module extension things installed and active?

Share this post


Link to post
Share on other sites

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?!?!?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.