HTTP: Difference between revisions
Content deleted Content added
Line 55: | Line 55: | ||
link cfunc |
link cfunc |
||
procedure main(args) |
procedure main(args) |
||
get(args[1 |
get(args[1]) |
||
end |
end |
||
procedure get( |
procedure get(url) |
||
local f |
local f, host, port, path |
||
url ? { |
|||
="http://" | ="HTTP://" |
|||
host := tab(upto(':/') | 0) |
|||
if not (=":" & (port := integer(tab(upto('/'))))) then port := 80 |
|||
if pos(0) then path := "/" else path := tab(0) |
|||
} |
|||
write(host) |
|||
write(path) |
|||
f := tconnect(host, port) | stop("Unable to connect") |
f := tconnect(host, port) | stop("Unable to connect") |
||
writes(f, "GET ", |
writes(f, "GET ", path | "/" ," HTTP/1.0\r\n\r\n") |
||
while write(read(f)) |
while write(read(f)) |
||
end |
end |
||
Using it |
Using it |
||
|icon req.icn www.rosettacode.org |
|icon req.icn http://www.rosettacode.org |
||
=={{header|Java}}== |
=={{header|Java}}== |