[erlang-questions] Making HTTP requests in Erlang
Jon Gretar Borgthorsson
jongretar@REDACTED
Sun Jun 7 23:39:53 CEST 2009
You have to start inets before making http calls. For https you will also
have to start ssl.
inets:start(),
{ok, Result} = http:request("http://google.com/"),
ssl:start(),
{ok, SecureResult} = http:request("https://google.com/").
On Sun, Jun 7, 2009 at 9:32 PM, Stuart Loxton
<stuart.loxton@REDACTED>wrote:
> Hi,
>
> I'm having a few problems making HTTP requests in Erlang and however much I
> try I can't work out what's wrong. Places I've looked and things I've tried.
>
> 1. erlang docs on http module
> 2. Googling everything
> 3. Using google codesearch.
>
> I've tried even the simplest of functions: http:request("
> http://google.com/") and it comes up with a large error:
>
> ** exception exit: {noproc,
> {gen_server,call,
> [httpc_manager,
> {request,
> {request,undefined,<0.149.0>,0,http,
> {"stuartloxton.com",80},
> "/",[],get,
>
> {http_request_h,undefined,"keep-alive",undefined,undefined,
>
> undefined,undefined,undefined,undefined,undefined,...},
> {[],[]},
>
> {http_options,"HTTP/1.1",infinity,true,[],undefined,false},
> "http://stuartloxton.com/
> ",[],none,[]}},
> infinity]}}
> in function gen_server:call/3
> in call from http:handle_request/6
>
> Anyone know what really simple mistake I've made?
>
> Thanks in advance!
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
>
More information about the erlang-questions
mailing list