Question title, this is one of the questions asked in a group. is actually the HTTP server uploads the download function. Kyung-Liang answered the solution to the problem.
Ibrowse:start ().
Ibrowse:send_req ("Http://img1.gtimg.com/12/1293/129340/12934049_980x1200_0.jpg", [], get, [], [{save_response_to_ File, True}]).
As normal return:
You can also specify the destination file to save the path: Ibrowse:send_req ("http://img1.gtimg.com/12/1293/129340/12934049_980x1200_0.jpg", [], get, [], [{ Save_response_to_file, "/tmp/test.jpg"}]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 's answer is concise and clear. How is this problem solved? Yes, it is using the ibrowse framework. So what is IBrowse? It is the client framework for HTTP.
IBrowse is an HTTP client written in Erlang (ibrowse) is an HTTP agent written using Erlang. )
Project Address: Https://github.com/cmullaparthi/ibrowse
Preparatory work:
1. Download source code
Use Git to get the meta code and execute the command at the terminal:
git clone https://github.com/cmullaparthi/ibrowse.git
2. Compiling source code
Compile the source code using the Rebar build tool:
./rebar Compile
Compiled successfully, the. Beam and. App files are generated under the Ebin folder.
(Note: This is where you put the dependencies of the project, such as: Deps path, in the Retool.config file below rel, also add the corresponding path.) such as:)
If you do not add this location, the dependency is not referenced.
Try: First enter the Shell,./rel/new_push/bin/new_push attach
1> Ibrowse:start ().
Below:
See, put test.jpg picture in the path of/opt/new_push/rel/files (where can be based on the actual to do).
See details:
and view slices:
And this ibrowse and Erlang's own inets have what pros and cons difference, of course, can also use inets to engage.
Record the download of files in Erlang using HTTP