I'm trying to make a connection via mod_harbour as follows:
browse --> 127.0.0.1/tvsisrevweb.prg?tvlis001
// tvlis001 is a class that lives in the sisrev.exe application, which I access through port 81 in TwebServer()
I need to get all the information from the browse, the same way it's done in tSocket.prg via ::GetData()
Is there any function I can use in mod_harbour,
below the prg I'm creating
- Code: Select all Expand view RUN
/*========================================================================
SISREV INFORMATICA LTDA.
Prestando serviços com qualidade desde 1993
CNPJ: 02.623.572/0001-52
CNPJ: 02.623.572/0002-33
========================================================================
Sistema..: S i s r e v - Win 5.0
Autor(es): Ariovaldo da Costa Foliene
Aplicação: TVSisrevWeb.prg
Notas....: Servidor do Sisrev-Web
Data.....: 02-03-2023
========================================================================
rodar no mod_harbour e pegar chamadas do apache passar para o Sisrev.exe
e retornar a página e resultados.
========================================================================
*/
* ========================================================================
Function Main( cData )
* ========================================================================
local pSocket
local cBuffer
local nBytes
local cRequest
local cResponse := ""
local oErr
local cMethod := AP_GetEnv("REQUEST_METHOD")
TRY
INetInit()
pSocket := INetConnect( "127.0.0.1", 81 ) // outra aplicação rodando TWebServer na porta 81
IF INetErrorCode( pSocket ) <> 0
? "Socket error:", INetErrorDesc( pSocket )
INetCleanUp()
QUIT
Endif
// send HTTP request to server
if cMethod == "GET" ; cRequest := GET( cData )
Elseif cMethod == "POST" ; cRequest := POST( cData )
Endif
MemoWrit("c:\request.txt", cRequest )
nBytes := INetSend( pSocket, cRequest )
while nBytes > 0
cBuffer := Space( 8192 )
nBytes := INetRecv( pSocket, @cBuffer )
cResponse += Left( cBuffer, nBytes )
end
INetClose( pSocket )
INetCleanUp()
Memowrit( "c:\harbour.txt", cResponse )
? cResponse // ok a página é mostrada no browse
CATCH oErr
? "Erro: " + oErr:Operation
END
return cResponse