php - Google Fusion Tables API results in Bad Request -
updating
I've been using Google Fusion Tables API to retrieve rows from Fusion Table (I rows I'm trying, but am trying to keep it right until I get the connection right). The table is set to be unlisted and downloadable in its list. I have an API key because the request is that when I load it in the browser works fine, but when I execute my code, I receive a wrong request from Google I am using the code given below:
Note: I am not using Oauth at this time to prove the request. The documentation states that it is not necessary if you are using GET string and sql statements to manipulate data. The key given below should work from any source, but I have to switch to the server key for security.
$ seller list = Dana :: MillModel ('Market / UserProfile') - & gt; GetCollection () - & gt; AddFieldToFilter ('partnerstatus', array ('eq' = & gt; 'vendor')) - & gt; AddFieldToFilter ('wantpartner', array ('eq' = & gt; 1)); Forex Currency ($ seller $ $ as seller) {$ profileurl = Mage :: getUrl () "Bajarpet / vendor / profile / .- Seller- gt; getProfileurl (); if ($ Seller- & gt; getshoptitle ()! = '') {$ Shoptitle = $ Seller- & gt; getshoptitle ();} and { $ Shoptitle = $ Seller- & gt; getprofileurl ();} $ logo = $ Seller- & gt; getlogopic () == ''? "Noimage.png": $ Seller- & gt; getlogopic (); $ logo = Dana :: getBaseUrl (Mage_Core_Model_Store :: URL_TYPE_MEDIA) 'Avatar /'.$ logo. $ Latitude = $ Seller- & gt; Friendly (); $ longitude = $ Seller- & gt; mg (); if ($ latitude! = = '') {$ req = curl_init (); Curl_setopt ($ req, CURLOPT_URL, urlencode ( "https://www.googleapis.com/fusiontables/v1/query?sql=SELECT RRIDID from 12RLP9qGYclz-kkDa_y_NJ1Meh81EZ K_5o7yp38sk WHERE shoptitle = '". $' '.' 'Key = AIzaSyAqt5biL_4nsZ25ZZC1RaeClssOIHXkn_k")); Curl_setopt ($ req, CURLOPT_RETURNTRANSFER, true); Curl_setopt ($ req, CURLOPT_HEADER, 0); Curl_setopt ($ req, CURLOPT_FRESH_CONNECT, true ); $ Reaction JSON = curl_exec ($ req); $ Resp = json_decode ($ response JSON, true); Curl_close ($ request); Print_r ($ responseJSON); }}
Do not encode the full URL, you only need to enter the GET-parameter ( http_build_query
would be a good option for this):
curl_setopt ($ req, CURLOPT_URL, 'https://www.googleapis.com/fusiontables/v1 / Query? Choose '.http_build_query (array (' sql '= & gt; "12rLP9qGYclz-kkDa_y_NJ1Meh81EZK_5o7yp38sk Choose from ROWID WHERE shoptitle =' {$ shoptitle} '",' key '=>' AIASAITBBNMSNGS 2525ZZC1RaeClssOIHXkn_k ')));
Comments
Post a Comment