Home > Networking > How to make http post

How to make http post

February 24th, 2009

Erlang Documentation for http:request/4 does have the function description but it lacks of concrete example for making http post. Here we go:

Make sure inets is started

1> inets:start().
ok
2> http:request(post, {
2> "http://www.google.com/",
2> [], 
2> "application/x-www-form-urlencoded",
2> "hl=en&q=erlang&btnG=Google+Search&meta="
2> },
2> [], []).
{ok,{{"HTTP/1.1",405,"Method Not Allowed"},
     [{"date","Tue, 24 Feb 2009 15:43:25 GMT"},
      {"server","gws"},
      {"content-length","1391"},
      {"content-type","text/html; charset=UTF-8"}],
...

You may notice that the content_type is application/x-www-form-urlencoded

Networking , , , ,

  1. dix
    February 2nd, 2011 at 02:50 | #1

    good

  2. Cici
    July 21st, 2011 at 21:49 | #2

    so,i want to know how to make a https request?

  3. Trung
    July 23rd, 2011 at 19:44 | #3

    @Cici: I’m sure you can find some useful information here.

  1. February 27th, 2009 at 08:11 | #1