GLBasic forum

Main forum => GLBasic - en => Topic started by: Marmor on 2013-Mar-02

Title: Netgetweb$ ?
Post by: Marmor on 2013-Mar-02
I try to get a Stream from a webcam but i get only a few Bytes (85) , so i think in the Stream is the
"Eof" for this command , but have netgetweb$ an "EOF" Char, or Not ?
MfG
Title: Re: Netgetweb$ ?
Post by: aroldo on 2013-Mar-02
Marmor,

I made this code to retrieve data from a web site, it may help you.

Run the code with the debug enabled.
Press the mouse button 1 (Left Button) to execute the WEBGET$ that returns the results in a string and the WEBGET that saves the result to a file.
When you are done click the mouse button 2 (Right Button)

Code (glbasic) Select
GLOBAL server$=""
GLOBAL path$=""
GLOBAL port%=0
GLOBAL results$=""
GLOBAL result%
GLOBAL timeout%=0
GLOBAL max_length%=0
GLOBAL url
GLOBAL file$
GLOBAL mx=0, my=0, b1=0, b2=0, bl=0

init()
PRINT "WEBGET", 0,0
SHOWSCREEN
main:
MOUSESTATE mx, my, b1, b2
        IF b2
             end
        ELSEIF b1
             update()
         ENDIF
goto main

FUNCTION init:
server$="sports.espn.go.com"
path$="/espn/rss/rpm/news"
port%=80
max_length%=1024
timeout%=5000
file$="rsa.html"
ENDFUNCTION

FUNCTION update:
        PRINT "Getting Results", 0, 10
        SHOWSCREEN
        webget()
webgetfile()
ENDFUNCTION
FUNCTION webget:
results$ = NETWEBGET$ (server$, path$, port%, max_length%, timeout%)
DEBUG " - " + results$
ENDFUNCTION
FUNCTION webgetfile:
result = NETWEBGET (server$, path$, port%, file$, timeout%)
        DEBUG " * " + result
ENDFUNCTION
Title: Re: Netgetweb$ ?
Post by: Marmor on 2013-Mar-03
thx Aroldo  :good: