Nitin
Nitin

Reputation: 237

HTTP POST request with Erlang

I am using the code below for sending an HTTP POST request, and it's not giving any error but I am not able to hit the server using this. Can anyone help me determine what could be the issue with this, or if I am missing something.

start() ->
    inets:start(),
    io:fwrite("inet started \n"),
    httpc:request(post, {"[http://api.myapp.com/apipush.php]", [],
                         "application/x-www-form-urlencoded", ""},[],[]),
    io:fwrite("req sent!\n").

Upvotes: 0

Views: 774

Answers (1)

Steve Vinoski
Steve Vinoski

Reputation: 20014

I think you have some misplaced square brackets in your call to the server. Remove the [ and ] from around the URL, like this:

httpc:request(post, {"http://api.myapp.com/apipush.php", [],
                     "application/x-www-form-urlencoded", ""},[],[]),

Upvotes: 3

Related Questions