REM ***********************************************
REM Title: HTTP retrieve page
REM Author: Markus
REM Downloaded from: http://dbcc.zimnox.com/
REM ***********************************************
 
 
 
MainLoop()
end
 
 
 
function MainLoop()
 
    Response$ = GetFromWeb("www.zimnox.com","index.php")
 
    do
        Print("hello internet")
        Print(Response$)
        if getPointerPressed() = 1 then exit
        Sync()
    loop
 
endfunction
 
 
 
function GetFromWeb(Host$,URLPath$)
 
    Response$=""
 
    if GetInternetState()=1
        iHTTP=CreateHTTPConnection()
        iSecure=0
        szUser$=""
        szPass$=""
        if SetHTTPHost( iHTTP, Host$, iSecure, szUser$, szPass$ ) = 1
            if SendHTTPRequestASync( iHTTP, URLPath$ ) = 1
                do
                    ret = GetHTTPResponseReady( iHTTP )
                    if ret = -1 then exit   //Cancel
                    if ret = 1 then exit    //Ready
                    print("wait ...")
                    sync()
                loop
                if ret=1
                    Response$=GetHTTPResponse( iHTTP )
                endif
            endif //Get
            CloseHTTPConnection( iHTTP )
        endif   //Host
        DeleteHTTPConnection( iHTTP )
    endif //Internet
 
endfunction Response$