标签: python ruby http
如何发送帖子请求并在ruby中获取响应
请求是,
名= $ name_val
网址为http://example.com/a/2
我如何在python或ruby中执行此操作?
答案 0 :(得分:1)
在python中执行此操作:
import urllib data = urllib.urlencode({ "fieldName1" : "Val1", "fieldName2" : "Val2", "fieldName3" : "Val3" }) f = urllib.urlopen("http://example.com/a/2", data) html = f.read() # this is the response