I have written server code in vb.Net. I want it to read to variables sent by another server's HTTP 'GET' request. For example the first server will send this URL
http://localhost/sms/incoming.php?sender=$originator&receiver=$recipient&msgdata=$messagedata&recvtime=$receivedtime&msgid=$messageid
where the values to be used by my server are sender, receiver, msgdata, recvtime and msgid I have written my code but it only reads the address sent by the http server and locates for the file in the server's root directory. I want the server to be reading the variables sent by the other server using the HTTP 'GET' request. My code is shown below
' the web server only accepts get requests.
If Mid(LCase(sbuffer), 1, 3) <> "get" Then
'if not GET request then close socket and exit
mySocket.Close()
Return
End If
' Extract path and filename from request
sRequest = sbuffer.Substring(0, iStartPos - 1)
sRequest.Replace("\\", "/")
If ((sRequest.IndexOf(".") < 1) AndAlso (Not sRequest.EndsWith("/"))) Then
sRequest = sRequest & "/"
End If
iStartPos = sRequest.LastIndexOf("/") + 1
' Get the filename
sRequestedFile = sRequest.Substring(iStartPos)
' Get the relative path
sDirName = sRequest.Substring(sRequest.IndexOf("/"), sRequest.LastIndexOf("/") - 3)
' Web server root path
sLocalDir = sMyWebServerRoot
' if no filename specified
' look for default file
If (sRequestedFile.Length = 0) Then
sRequestedFile = _DefaultPage
sPhysicalFilePath = sLocalDir & sDirName & sRequestedFile
' if no default file and no directory requested
' then show welcome page
If Not File.Exists(sPhysicalFilePath) AndAlso (sDirName = "" OrElse sDirName = "/") Then
sErrorMessage = sErrorMessage & "<BR><BR>No root directory found. Set up the root directory in the configuration file.</H2>"
SendHeader(sHttpVersion, "", sErrorMessage.Length, " 404 Not Found")
SendToBrowser(sErrorMessage)
mySocket.Close()
Return
End If
End If