Google search

Google search

Postby karinha » Thu Mar 23, 2023 6:21 pm

http://fivewin.com.br/index.php?/topic/36548-google-search/

Feito Sandor. Obrigado.

Code: Select all  Expand view  RUN

// C:\FWH\SAMPLES\GOOGLEBU.PRG - MODIFICADO EM: 23/03/2023 - Joao Santos.

#include "FiveWin.ch"

// The example loads the Google search page and enters "xHarbour" as
// query data. The response from Google for the query is stored in a local
// HTML file.

PROCEDURE Main

   LOCAL oHttp, cHtml, hQuery, cFile

   oHttp := TIpClientHttp():new( "http://www.google.de/search" )

   // build the Google query
   hQUery := Hash()
   hSetCaseMatch( hQuery, .F. )

   hQuery[ "q" ]    := "xHarbour"
   hQuery[ "hl" ]   := "en"
   hQuery[ "btnG" ] := "Google+Search"

   /*
   hQuery[ "q" ]    := "FiveWin"
   hQuery[ "hl" ]   := "en"
   hQuery[ "btnG" ] := "Google+Search"
   */


   // add query data to the TUrl object
   oHttp:oUrl:addGetForm( hQuery )

   // Connect to the HTTP server
   IF oHttp:open()

      // downlowad the Google response
      // cHtml := oHttp:readAll()

      // http://fivewin.com.br/index.php?/topic/ ... le-search/

      /*
      Fala Kapi...  Faz tempo que não 'posto' por aqui mas vai lá...

      Não sei onde achou isso, mas é interessante.

      Uma pequena alteração: troque alinha:

      cHtml := oHttp:readAll()    //  Kapi

      por:
      */


      cHtml := strtran(oHttp:readAll(), "/images/br", "http://www.google.com/images/br")
      cHtml := strtran(cHtml, 'CsQyDc" href="', 'CsQyDc" href="http:\\www.google.com')

      /*
      Vai mostrar o ícone do GOOGLE e 'liberar' os links de  "VIDEOS", "IMAGES" e "NEWS"

      [ ]'s, Sandor
      */


      MemoWrit( "Google_xHarbour.html", cHtml )

      oHttp:close()

      // ? Len( cHtml ), "bytes Recebidos: "
      MsgInfo( Len( cHtml ), "bytes Recebidos: " )

      // ? "e Gravados Para o Arquivo: Google_xHarbour.html"
      MsgInfo( "e Gravados Para o Arquivo: Google_xHarbour.html", "Gravou em:" )

      ShellExecute( 0, "Open", "c:\fwh1905\samples\Google_xHarbour.html" )

   ELSE

      ? "Connection error:", oHttp:lastErrorMessage()

   ENDIF

RETURN NIL

// FIN - kapiabafwh@gmail.com
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7828
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Google search

Postby Antonio Linares » Thu Mar 23, 2023 8:00 pm

many thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 62 guests