2015-09-05 154 views
0

我正在使用下面的代碼發送HTTP POST請求,並沒有給出任何錯誤,但我無法使用此命令來訪問服務器。任何人都可以幫助我確定這可能是什麼問題,或者如果我錯過了什麼。與Erlang的HTTP POST請求

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"). 

回答

2

我想你在調用服務器時有一些放錯方括號。從URL周圍刪除[],如下所示:

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