File: netgethomepage.kbs

package info (click to toggle)
basic256 2.0.99.10-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,888 kB
  • sloc: cpp: 17,185; yacc: 4,025; lex: 1,466; java: 1,091; sh: 39; xml: 33; makefile: 20
file content (26 lines) | stat: -rw-r--r-- 618 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# netgethomepage.kbs - connect to a web site and download
# the home page into a variable

site$ = "www.yahoo.com"
port = 80
NETCONNECT site$, port
print "connected to " + site$ + ":" + port

get$ = "GET http://" + site$ + "/ HTTP/1.0" + chr(13) + chr(10)
get$ = get$ + chr(13) + chr(10)
NETWRITE get$
print "request written"

s$ = ""
do
   chunk$ = netread
   print "chunk  '" + left(chunk$,10) + "..." + right(chunk$,10) + "'" + length(chunk$)
   s$ = s$ + chunk$
   # wait for more data / may need to adjust for a slower connection
   pause .2
until not netdata
NETCLOSE

print "response"
print s$
print length(s$)