Use Winsock DLL - Port 80 unless using SSL 0 then you need to look it up cuz I forget - its google away....
You want a persistant connection usually - you need to build a HTTP HEADER - its a request - its funny too because you get to name your software in the header - I used to get a kick of messing with people's STAT Software - cuz they See: IE Mozille, Netscape, Opera, FireFox, Hi Mom.... Hi Mom? WTF LOL
Once the hit is made - you poll (or set up an event handler thats called when data is coming back at ya) for when the data is ready - its pure text - then you need to parse through the returned junk until you get the data you want.
I have some FreePascal Source with the HTTP header stuff and the Return Formats I think - as for accessing the Win sock - check this out:
(Not my code but good little helper ref for winsock)
Quote: "Sure, here's a little example of how to set up a basic single-client server. Open command prompt and type telnet 127.0.0.1 1337 to connect to it.
"
` Structure sizes ------------------------
#constant SIZEOF_WSADATA 400
#constant SIZEOF_SOCKET 4
#constant SIZEOF_SOCKADDR 16
` ----------------------------------------
` Other constants ------------------------
#constant WINSOCK_DLL 255
#constant PORT_NUMBER 1337
#constant IP_ADDRESS "127.0.0.1"
#constant SOCKET_ERROR -1
#constant INVALID_SOCKET -1
` ----------------------------------------
` Load the Winsock DLL
load dll "ws2_32.dll", WINSOCK_DLL
` Make memory For variables
addr = make memory(SIZEOF_SOCKADDR)
` Initialize variables (to Show what we're using)
socket = 0
clientSocket = 0
` Initialize Winsock (returns 0 On success, unlike most other functions here) result = WSAStartup() If result <> 0
Print "WSAstartup failed: "+Str$(result)
wait key
End
endif
` Make socket
socket = MakeSocket()
If socket = SOCKET_ERROR
Print "MakeSocket failed: "+Str$(WSAGetLastError())
wait key
End
endif
` Set address details
SetAddress(PORT_NUMBER, IP_ADDRESS, addr)
` Bind
result = Bind(socket, addr)
If result = SOCKET_ERROR
Print "Bind failed: "+Str$(WSAGetLastError())
wait key
End
endif
` Listen
result = Listen(socket)
If result = SOCKET_ERROR
Print "Listen failed: "+Str$(WSAGetLastError())
wait key
End
endif
` Wait For new connection (this blocks until a new connection) Print "Waiting for client..." clientSocket = Accept(socket) If clientSocket = INVALID_SOCKET
Print "Accept failed: "+Str$(WSAGetLastError())
wait key
End
endif
Print "Client connected."
` Send a String
result = SendString(clientSocket, "Hello world.")
If result = SOCKET_ERROR
Print "Send failed: "+Str$(WSAGetLastError())
wait key
End
endif
wait key
End
` Winsock functions ----------------------
Function WSAStartup() ` Initializes Winsock
wsdata = make memory(SIZEOF_WSADATA)
result = Call dll(WINSOCK_DLL, "WSAStartup", 0x202, wsdata)
Delete memory wsdata
endfunction result
Function MakeSocket() ` Makes a socket
result = Call dll(WINSOCK_DLL, "socket", 2, 1, 6) endfunction result
Function Bind(socket As dword, addrPtr As dword) ` Associates socket With address
result = Call dll(WINSOCK_DLL, "bind", socket, addrPtr, SIZEOF_SOCKADDR) endfunction result
Function Listen(socket As dword) ` Allows socket to Accept connections
result = Call dll(WINSOCK_DLL, "listen", socket, 10) endfunction result
Function Accept(socket As dword) ` Accepts a connection (blocks until)
result = Call dll(WINSOCK_DLL, "accept", socket, 0, 0) endfunction result
Function WSAGetLastError() ` Retrieves last Error code
result = Call dll(WINSOCK_DLL, "WSAGetLastError") endfunction result
Function htons(number As word) ` Converts value to big endian
result = Call dll(WINSOCK_DLL, "htons", number)
endfunction result
Function inet_addr(ip As String) ` Converts IP String to DWORD
result = Call dll(WINSOCK_DLL, "inet_addr", ip)
endfunction result
` ----------------------------------------
` Other functions ------------------------
Function SetAddress(port As word, ip As String, addrPtr As dword)
familyAndPort = 2 or (htons(port) << 16)
*addrPtr = familyAndPort
tempPtr = addrPtr + 4
*tempPtr = inet_addr(ip)
endfunction
Function SendString(socket As dword, strData As String)
strData = strData + Chr$(13) + Chr$(10)
result = Call dll(WINSOCK_DLL, "send", socket, strData, Len(strData)+1, 0) endfunction result
` ----------------------------------------
Hope that gives you some idea of how it's achieved.