HTTP Services




SUB HTTP( IPaddress, CGIstring AS STRING)


This allows a BASIC program to do a GET or POST to server somewhere on the web.  The BASIC program needs to know the IP address of the server and that is passed to HTTP as a 32 bit value.

The CGI string should include either GET or POST followed by the web address (can be index.html) and may be followed by a CGI request which typically follows a ?.   For example this is the same as   which could be a local server on your network.  This also works for any IP on the web as well.

The purpose of this is to send a CGI message to a server, but the first 256 bytes that the server returns for the request will be placed into the CGI buffer.  Any data after that will be dropped.   As this is shared with the CGIIN buffer, you should not be trying to use both as one or the other will be lost.

This function requires version 7.58 of the firmware.


DIM A_STRING(256) as string
DIM IP_ADDR as integer
DIM i as integer

' IP Address of my local web server
IP_ADDR = (192<<24)+ (168<<16) +(1<<8) + 4

i = 123 ' some value to send in CGI

' Build a request string, could also be a POST
' In this case include CGI
A_STRING = sprintf("GET /index.htm?i=%d %c%c%c%c",i,13,10,13,10)

' Example read a local page server

See also