Please enable JavaScript to view this site.

thinBasic Help Manual

* * HELP & MANUAL PREMIUM PACK 4 DEMO VERSION * *

This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.

This version is copyright and may only be used for local testing purposes. It may not be distributed.

Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.

'--------------------------------------------------------------------------------

' - connect to a web site

' - ask for a page

' - save it into a buffer

' - save the buffer into a text file

'--------------------------------------------------------------------------------

 

'---Load TCP module

USES "TCPUDP"

 

'---Load File module

USES "FILE"

 

'---Define some global variables and init them

Dim MyPage As String = "http://www.thinbasic.com/index.php"

Dim MySite As String = "www.thinbasic.com"

 

Dim sBuffer As String

Dim sPage   As String    

Dim Count   As Long

 

'---Get a file number

Dim nFile   As Long = Tcp_FreeFile

 

'---Open a connection

TCP_Open("http", MySite, nFile)

 

'---Send request

TCP_Print(nFile, "GET " & MyPage & " HTTP/1.0")

TCP_Print(nFile, "Referer: http://www.thinbasic.com/")

TCP_Print(nFile, "User-Agent: TCP Test using thinBasic")

TCP_Print(nFile, "")

 

'---Get back data in a loop

Do                                            

INCR Count

 sBuffer = TCP_Recv(nFile, 4096)

 sPage = sPage & sBuffer

Loop While ((Len(sBuffer) > 0) And (ERR = 0))

 

'---Close the channel

TCP_Close(nFile)

 

'---Save the page

File_Save(APP_SourcePath & "Page.txt", sPage)

 

Created with Help+Manual 8 and styled with Premium Pack Version 4 © by EC Software