我想从 Python 中的这段代码切换到 Erlang:
Python:
import httplib
body="<xml>...</xml>"
headers = { \
"Accept" : "text/*" , \
"User-Agent" : "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" , \
"Host" : "something.com" , \
"Content-Length" : str( len( body ) ) , \
"Connection" : "Keep-Alive" , \
"Cache-Control" : "no-cache" , \
}
server="something.com"
url="/s.srf"
conn = httplib.HTTPSConnection(server,443)
conn.request("POST", url, body, headers)
-> 我试过这个 Erlang:
Headers=[
{"Accept","text/*"},
{"User-Agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"},
{"Host","something.com"},
{"Content-Length",string:len(Body)},
{"Connection","Keep-Alive"},
{"Cache-Control","no-cache"}
].
httpc:request(post,{Server,Headers,[],Body},[],[]).
但我不知道我可以把网址“/s.srf”放在哪里,有什么想法吗?