FWH and Google Tables

Post Reply
Natter
Posts: 1289
Joined: Mon May 14, 2007 9:49 am

FWH and Google Tables

Post by Natter »

Hi,

Can I work with Google Tables from FWH ?
User avatar
Antonio Linares
Site Admin
Posts: 42854
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 185 times
Been thanked: 124 times
Contact:

Re: FWH and Google Tables

Post by Antonio Linares »

Yes, you have to use curl:

Code: Select all | Expand

#include "hbcurl.ch"function Main()   ? BigQuery( "select ..." )return nilfunction BigQuery( cQuery )   local hCurl, cBuffer := ""   local aData := {}   local aResult   local cUrl := "https://www.googleapis.com/bigquery/v2/projects/your_project_name/queries"   curl_global_init()   if ! empty( hCurl := curl_easy_init() )      curl_easy_setopt( hCurl, HB_CURLOPT_URL, cUrl )      curl_easy_setopt( hCurl, HB_CURLOPT_DL_BUFF_SETUP )      curl_easy_setopt( hCurl, HB_CURLOPT_HTTPAUTH, HB_CURLAUTH_BASIC )      curl_easy_setopt( hCurl, HB_CURLOPT_POST, 1 )      curl_easy_setopt( hCurl, HB_CURLOPT_HTTPHEADER, { "Content-Type:application/json" } )      curl_easy_setopt( hCurl, HB_CURLOPT_HTTPHEADER, { "Authorization: Bearer yourOauth2key" } )      curl_easy_setopt( hCurl, HB_CURLOPT_POSTFIELDS, ' { "configuration" : { "query" : { "query" : cQuery } } }' )      if curl_easy_perform( hCurl ) == 0         cBuffer = curl_easy_dl_buff_get( hCurl )         if ! empty( cBuffer )            hb_jsonDecode( cBuffer, @aData )         endif      else         ? "error"      endif   endif   curl_global_cleanup()return If( ! Empty( aData ), aData,)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Natter
Posts: 1289
Joined: Mon May 14, 2007 9:49 am

Re: FWH and Google Tables

Post by Natter »

Thank You, Antonio ! I will try
MMK
Posts: 15
Joined: Thu Jan 22, 2009 6:24 am
Been thanked: 2 times

Re: FWH and Google Tables

Post by MMK »

What file *.bat from Fwh\samples should be used for assembly of this example?
It Harbour or xHarbour?
What else files (dll) are necessary for its work?
I did not find "hbcurl.ch"

Many thanks!
User avatar
Antonio Linares
Site Admin
Posts: 42854
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 185 times
Been thanked: 124 times
Contact:

Re: FWH and Google Tables

Post by Antonio Linares »

hbcurl.ch is available from:
https://github.com/harbour/core/tree/master/contrib/hbcurl

Use Harbour

You may use FWH\samples\buildh.bat if you want to use CURL from a FWH app, or simply use FWH\samples\build.bat if you don't want to include FWH
regards, saludos

Antonio Linares
www.fivetechsoft.com
Natter
Posts: 1289
Joined: Mon May 14, 2007 9:49 am

Re: FWH and Google Tables

Post by Natter »

Is it possible to run a google table macro using cURL ?
Post Reply