Support the ongoing development of Laravel.io →
posted 8 years ago
Requests
Last updated 2 years ago.
0

It's obviously your app that don't deliver a proper POST request. You should probably ask on a forum made for iOS devs, I think you will have better luck there.

0

mengidd said:

It's obviously your app that don't deliver a proper POST request. You should probably ask on a forum made for iOS devs, I think you will have better luck there.

Actually what I'm trying to understand is what Laravel needs to interpret a request as POST.

Because I'm pretty sure that my app is making a POST request, obviously not a good one, so to fix that I wanted to provide all the information in the request.

Knowing that I can then bind a proper POST request from my app, giving no margin to interpret as a different request.

Last updated 8 years ago.
0

No idea how Laravel handles request, but one way to see if your app is correctly sending a post request is to hit a page where you return $_SERVER['REQUEST_METHOD']. If it's POST this is a Laravel problem, if it's not it's your app :-)

0

mengidd said:

No idea how Laravel handles request, but one way to see if your app is correctly sending a post request is to hit a page where you return $_SERVER['REQUEST_METHOD']. If it's POST this is a Laravel problem, if it's not it's your app :-)

I did as you said. I created a php file in my public folder:

post.php
<?php
    /**
     * Created by PhpStorm.
     * User: renato
     * Date: 06/01/16
     * Time: 18:13
     */


    $method = $_SERVER['REQUEST_METHOD'];
    $json = json_encode(['response' => $method], true);

    echo $json;

When I tried accessing post.php with my app it returned

{ response = POST; }

I'm losing my mind here... I really don't know what the problem is...

0

Turned out to be a problem with the trailing slash. It was 301 redirecting my post requests to a get request.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

renatop7 renatop7 Joined 6 Jan 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.