本文介绍了如何使用Erlang进行HTTPS请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试了 inets
库,但它超时。我不认为它支持HTTPS。我试图使用ibrowse,但是它不起作用。
I tried the inets
library but it times out. I don't think it supports HTTPS. I am trying to use ibrowse, but it isn't working.
推荐答案
这对我来说很好:
1> application:start(inets).
ok
2> application:start(ssl).
ok
3> http:request(head, {"https://example.com", []}, [{ssl,[{verify,0}]}], []).
{ok,{{"HTTP/1.1",200,"OK"},
[{"cache-control","max-age=0, proxy-revalidate"},
{"date","Sun, 23 May 2010 00:38:33 GMT"},
{"server","BAIDA/1.0.0"},
{"content-type","text/html; charset=windows-1251"},
{"expires","Sun, 23 May 2010 00:38:33 GMT"},
{"set-cookie",
"uid=9041986921274575113; domain=.example.com; path=/; expires=Tue, 19 Jan 2038 03:14:07 GMT"}],
[]}}
http:request(https://example.com)
也可以工作,只需在任何请求之前加载相应的应用程序。
http:request("https://example.com")
would also work though, you just have to load appropriate applications before any request.
这篇关于如何使用Erlang进行HTTPS请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!