Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
-module (translation).
-export ([get_translation/1]).
get_translation(Word) ->
io:format("~p ~n", [Word]),
inets:start(),
{ok, RequestId} = httpc:request(get, {"http://fanyi.dict.cn/search.php?q=" ++ Word, []}, [], [{sync, false}]),
receive
{http, {RequestId, Result}} ->
io:format("~p ~n", [Result])
after 1000 -> timeout
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment