Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
14
Task/HTTP/Zkl/http.zkl
Normal file
14
Task/HTTP/Zkl/http.zkl
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
url := ask(0,"URL: ");
|
||||
|
||||
host := url;
|
||||
dir := "/";
|
||||
port := 80;
|
||||
if (n := url.find("/")) { dir = url[n,*]; host = url[0,n]; }
|
||||
if (n := host.find(":")) { port = host[n+1,*]; host = host[0,n]; }
|
||||
|
||||
get := "GET %s HTTP/1.0\r\nHost: %s:%s\r\n\r\n".fmt(dir,host,port.toInt());
|
||||
println("-->",get);
|
||||
server := Network.TCPClientSocket.connectTo(host,port);
|
||||
server.write(get);
|
||||
data := server.read(True);
|
||||
println(data.text);
|
||||
Loading…
Add table
Add a link
Reference in a new issue