Send POST data to PHP without using an HTML form?

前端 未结 7 2002
眼角桃花
眼角桃花 2020-12-08 11:54

Is there anyway to send post data to a php script other than having a form? (Not using GET of course).

I want javascript to reload the page after X seconds and post

7条回答
  •  春和景丽
    2020-12-08 12:18

    Form your own header, as such:

    POST /submit.php HTTP/1.1
    Host: localhost
    User-Agent: Mozilla/4.0
    Content-Length: 27
    Content-Type: application/x-www-form-urlencoded
    
    userId=admin&password=letmein
    

提交回复
热议问题