0

http with method post

Hello, i try this code bellow in a button 

let response := http("POST", "http://localhost/test.php", {
myParameter: "myParameterValue"
}, {
'Content-Type': "application/json"
});
if response.error then
alert("ERREUR:" + text(response.error))
else
alert("RESULT:" + text(response.result))
end

 

In the test.php i dont can retrive the parameter : myParameter

i try many thing, like : file_get_contents('php://input'); but i dont can retrieve the parameter.

But i know the request is sending good way to php file, because un simple echo in php is fired.

Any help?

Thanks

Robert

4 replies

null
    • CISOFT_Sarl
    • 5 yrs ago
    • Reported - view

    nobody use http with post method?

    • CISOFT_Sarl
    • 5 yrs ago
    • Reported - view

    a little help inside php for retrieve paramters sending with http() function and post method.

    • Alexander_Koenig
    • 5 yrs ago
    • Reported - view

    Hi Robert,

    we are having an API workshop on monday:

    https://zoom.us/webinar/register/WN_tNnu2wwPSHWtwZQvj3egFw

    Would you like to join?

    Best, Alex

    • aschlum
    • 2 yrs ago
    • Reported - view

    Hello,

    we also have the same problem: http POST - but parameters are not sent to the backend.

    let oauth := do as server
       http("POST", "https://api.digikey.com/v1/oauth2/token“, {'client_id': „xyz“ } )
    end;

    let oauth := do as server
       http("POST", "https://api.digikey.com/v1/oauth2/token“, { ‘content-type’:“application/json“}, {'client_id': „xyz“ } )
    end;

    let oauth := do as server
       http("POST", "https://api.digikey.com/v1/oauth2/token“, {'client_id': „xyz“ }, { ‘content-type’:“application/json“} )
    end;

    digikey returns always: "client_id" is undefined or null

    Thanks
    Achim

Content aside

  • 2 yrs agoLast active
  • 4Replies
  • 2109Views