Hi,
adapting this example: https://www.thinbasic.com/public/pro...p_example1.htm because it is not working for me as-is;
'---Load Console Module
Uses "Console"
'--------------------------------------------------------------------------------
' - 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 = "https://www.thinbasic.com/index.php"'"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(443, MySite, nFile) ' <-- *** here 80 or 443 ***
'---Send request
TCP_Print(nFile, "GET " & MyPage)' & " HTTPS/1.0")
TCP_Print(nFile, "HOST: " & MySite)
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)
PrintL "Press a key to end program"
'---Wait for a key press
WaitKey
- Have you the same issue ?
I can't get it work with https port 443 (see https://www.thinbasic.com/public/pro...l?tcp_open.htm)
- Does it mean that accepted values are just the four mentioned aka either 80, 25, "HTTP", or "SMTP" ?
- Is using INet the only alternative ?
Bookmarks