Skip to content

Instantly share code, notes, and snippets.

@dongyuwei
Created June 5, 2017 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dongyuwei/dfac2fef04f61f7316c09bebb421eecd to your computer and use it in GitHub Desktop.
Save dongyuwei/dfac2fef04f61f7316c09bebb421eecd to your computer and use it in GitHub Desktop.
-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