browse information

mod_harbour is an Apache module that allows to run PRGs directly on the web !!!

browse information

Postby Ari » Thu Mar 02, 2023 2:49 pm

Hello friends,

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

 
Thanks,
Ari

FWH 2212 - Harbour 3.2.0 - Embarcadero 7.43 - MySQL
São Paulo - SP - Brasil
www.sisrev.com.br
User avatar
Ari
 
Posts: 234
Joined: Fri Feb 03, 2006 4:21 pm
Location: São Paulo, SP - Brazil

Re: browse information (Solved)

Postby Ari » Thu Mar 02, 2023 4:16 pm

Achei ! :lol:

? AP_HeadersIn()

Code: Select all  Expand view  RUN

{
  "Host": "127.0.0.1",
  "Connection": "keep-alive",
  "Cache-Control": "max-age=0",
  "sec-ch-ua": "\"Not_A Brand\";v=\"99\", \"Google Chrome\";v=\"109\", \"Chromium\";v=\"109\"",
  "sec-ch-ua-mobile": "?0",
  "sec-ch-ua-platform": "\"Windows\"",
  "Upgrade-Insecure-Requests": "1",
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
  "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
  "Sec-Fetch-Site": "none",
  "Sec-Fetch-Mode": "navigate",
  "Sec-Fetch-User": "?1",
  "Sec-Fetch-Dest": "document",
  "Accept-Encoding": "gzip, deflate, br",
  "Accept-Language": "pt-BR,pt;q=0.9,es;q=0.8"
}
 
Thanks,
Ari

FWH 2212 - Harbour 3.2.0 - Embarcadero 7.43 - MySQL
São Paulo - SP - Brasil
www.sisrev.com.br
User avatar
Ari
 
Posts: 234
Joined: Fri Feb 03, 2006 4:21 pm
Location: São Paulo, SP - Brazil


Return to mod_harbour

Who is online

Users browsing this forum: No registered users and 5 guests