kapiaba Posted March 20, 2023 Report Share Posted March 20, 2023 // C:\FWH\SAMPLES\GOOGLEBU.PRG #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() MemoWrit( "Google_xHarbour.html", cHtml ) oHttp:close() ? Len( cHtml ), "bytes Recebidos: " ? "e Gravados Para o Arquivo: Google_xHarbour.html" ShellExecute( 0, "Open", "c:\fwh1905\samples\Google_xHarbour.html" ) ELSE ? "Connection error:", oHttp:lastErrorMessage() ENDIF RETURN NIL // FIN Regards, saludos. Quote Link to comment Share on other sites More sharing options...
crisvam Posted March 22, 2023 Report Share Posted March 22, 2023 Bancana, Kapiaba Quote Link to comment Share on other sites More sharing options...
scpetho Posted March 23, 2023 Report Share Posted March 23, 2023 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 Quote Link to comment Share on other sites More sharing options...
kapiaba Posted March 23, 2023 Author Report Share Posted March 23, 2023 Feito Sandor. Obrigado. // 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/36548-google-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. Quote Link to comment Share on other sites More sharing options...
Theotokos Posted March 24, 2023 Report Share Posted March 24, 2023 desculpa a ignorância (burrice mesmo), para que serve isto? qual uso que vcs aplicam? Quote Link to comment Share on other sites More sharing options...
kapiaba Posted March 24, 2023 Author Report Share Posted March 24, 2023 Tá desculpado. Kkk teste e você vai entender. Veja no código onde está escrito xharbour, crie um diálogo com um GET e troque pela variável do GET, e você pode Search/Buscar o que quiser no GOOGLE SEARCH/BUSCA. tendeu? Nem eu... Kkkkkkkkkkkk Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.