【问题标题】:How to match payload in POST request如何在 POST 请求中匹配有效负载
【发布时间】:2017-07-05 15:32:12
【问题描述】:

我有一个这样的 GET 请求:

<FORM action='vieweto0.php' method='POST'>
  <SELECT name='ID_Profil'>
    <OPTION value=3> blank3</OPTION>
    <OPTION value=2> blank2</OPTION>
    <OPTION value=4>blank4</OPTION>
  </SELECT>
  <br><input type='submit' type=hidden name='OK' value='choose this one'>
</FORM>

如果我想选择 OPTION 'blank4',我的 POST 请求应该是什么样子?

我可以在哪里阅读更多关于这样的 POST 请求的信息?

【问题讨论】:

    标签: http request http-post python-requests


    【解决方案1】:

    如果你使用pythonrequests

    import requests
    res = requests.post("http://hostaddress/vieweto0.php", data={"ID_Profil":4})
    

    POST 或 GET 请求基本上是向服务器发送键值对。

    详细了解https://www.w3schools.com/html/default.asp 上的 http POST 以及 requests 如何处理此问题:http://docs.python-requests.org/en/master/user/quickstart/。如果您对 POST 的详细信息感兴趣,可以阅读:https://www.rfc-editor.org/rfc/rfc7231#section-4.3.3

    【讨论】:

      【解决方案2】:

      你可以使用这个 $_POST['ID_Profil'];

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-07-22
        • 2013-09-23
        • 2018-04-23
        • 2015-09-04
        • 2013-01-09
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多