POST a HTML Form programmatically?

你说的曾经没有我的故事 提交于 2019-12-08 03:24:25

问题


I need to POST a HTML form to a 3rd party website (a Mass-SMS texting system).

In the past I've done this by forwarding to a page containing a form I've pre-populated and hidden (using display:none), then I've ran a javascript function at the end of the page to automatically submit this form.

However I'm hoping theres someway I can do all this programmatically (as I don't care about the response, and the user doesn't need to see the page the form is being posted to).

How can I do this? Cheers


回答1:


You could use a WebClient.UploadValues method to send an HTTP POST request to a remote server from your code behind. Just fill up the name/value collection with the values coming from the hidden fields.




回答2:


If you're willing to get into PHP, you can very easily use cURL for this. Otherwise it's going to be quite difficult using just Javascript.

See here for a detailed tutorial.



来源:https://stackoverflow.com/questions/4757173/post-a-html-form-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!