September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 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