Search code examples
phppostsmssms-gateway

Url PUSH Issue in $_POST Method


Currently i have been working on a project which connects to a smsgateway. Once the user sends sms to gateway it redirects the requests to our server. Problem is they are received in $_GET method. But the sms provider says they are passing it in $_POST method. Url received at our end looks like the following.

http://www.example.com/smstest?msg=sample&id=55788

Is it possible to receive parameters in url when you use the $_POST method


Solution

  • You can only have one verb (POST, GET, PUT, ...) when doing an HTTP Request. However, you can do

    <form name="y" method="post" action"y.php?foo=bar">
    

    and then PHP will populate $_GET['foo'] as well, although the Request was POST'ed.

    For comment

    By using

    $_SERVER['REQUEST_METHOD']