How do I find a file on http://url_path/filename

Chris Pressey cpressey@REDACTED
Wed Apr 9 03:46:09 CEST 2003


On Tue, 8 Apr 2003 20:47:31 -0400 (EDT)
HP Wei <hp@REDACTED> wrote:

> I am a bit lost in the huge amount of docs.
> (It will get better when I am exposed to it for a while.)
> For now,
> Please tell me where I could find the module for doing:
> 
> (1) check if a file exists on http://url_path/filename?
> (2) retrieve that file to a local disk.
> 
> thanks,
> HP

Is this something like what you're looking for?

1> http:request_sync(get,{"http://www.erlang.org/foo",[]}).
{404,
 [{'Transfer-Encoding',"chunked"},
  {'Content-Type',"text/html"},
  {'Date',"Wed, 09 Apr 2003 01:43:27 GMT"},
  {'Server',"Apache/1.3.9 (Unix)"}],
 "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML
2.0//EN\">\n<HTML><HEAD>\n<TITLE>404 Not
Found</TITLE>\n</HEAD><BODY>\n<H1>Not Found</H1>\nThe requested URL /foo
was not found on this server.<P>\n<HR>\n<ADDRESS>Apache/1.3.9 Server at
<A HREF=\"mailto:webmaster@REDACTED\">www.erlang.org</A> Port
80</ADDRESS>\n</BODY></HTML>\n"}

It doesn't look like the http client module is documented yet.

-Chris



More information about the erlang-questions mailing list