简体   繁体   中英

How to send a form request (method = POST) to a page using the initial addres?

I need to solve this problem. I have to send a form using post request, but I have to send it to the page where the form is, and in all the solutions that I find to send the request you have to send it to the page where the results come, and to me this doesn't work because the page that I need to send the request to has a specific SID to each search you enter. Is there any way I could do this?

Example of code that doesn't work for my problem:

post_data = [("doesn't","work")]
result = urllib2.urlopen('http://www.for.my.problem', urllib.urlencode(post_data))
content = result.read()

thank you

如果请求需要发送到请求所在的同一页面,为什么只是直接调用响应方法,因为它们在同一页面中,可以访问该方法。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM