Note that there are some explanatory texts on larger screens.

plurals
  1. POCalling 2 curl requests in a row fails. "Length Required"
    primarykey
    data
    text
    <p>I am trying to create a google fusion table in PHP with code ignighter. Here is my code:</p> <pre><code>{ $this-&gt;load-&gt;library('curl'); $token_url = 'https://www.google.com/accounts/ClientLogin'; //set username and password $email = "xxxx@gmail.com"; $pass = "yyyyyy"; $request_body = array("accountType" =&gt; "HOSTED_OR_GOOGLE", "Email" =&gt; $email, "Passwd" =&gt; $pass, "service" =&gt; "fusiontables", "source" =&gt; "fusiontables.GoogleFusion", ); $resp = $this-&gt;curl-&gt;simple_post($token_url, $request_body, array(CURLOPT_HTTPHEADER =&gt; array('Content-Type: application/x-www-form-urlencoded')) ); $response = explode("=", $resp); $token = $response[3]; echo "token = ". $token . "&lt;br&gt;"; $url = "http://tables.googlelabs.com/api/query"; //$token = 'DQBBBLcAAABtXliIIvSrim6JpcrxFF23EKVEJHlrDob2TICiFGUISmUd6UXN3Y19MqvYozPuY973kPafpVEReFR8geHHpNGPeO2PGLr8aqQa__v2rZLR4XB0WwoNb0ksa2WWgve2tocgkfwFY4OjQkcbSqUZJbxPBNk5vYGT6kL9hZNNJRZX-XYhUGfYiGlpNyWA0Pe2ql23PsUVRKWotYjgTIKOzO_p6zEAbaEkoxZkpsioXQQqMTM2QFf-hKjYcbOai80IAQI'; print_r($this-&gt;curl-&gt;info); $post_data = array( "sql"=&gt;"CREATE TABLE 'table123' (word: STRING, geom: LOCATION, timestamp: DATETIME)", ); $resp = $this-&gt;curl-&gt;simple_post( $url, $post_data, array(CURLOPT_HTTPHEADER =&gt; array('Content-Type: application/x-www-form-urlencoded', "Authorization: GoogleLogin auth=" . $token)) ); echo "&lt;br&gt;"; print_r($this-&gt;curl-&gt;info); echo "&lt;br&gt;"; print_r($resp); } </code></pre> <p>I am using the following curl library - <a href="https://github.com/philsturgeon/codeigniter-curl" rel="nofollow">https://github.com/philsturgeon/codeigniter-curl</a> and, weirdly, if I uncomment the hard coded token line, the whole thing works. I have provided the info if needed, but the bottom line is I get error 411 "Length Required" and, from the info printed out none of the metadata for the request appear to be present (ie Content-Type) on the second request. </p> <p>Here is the info for the first request: </p> <pre><code>Array ( [url] =&gt; https://www.google.com/accounts/ClientLogin [content_type] =&gt; text/plain [http_code] =&gt; 200 [header_size] =&gt; 275 [request_size] =&gt; 268 [filetime] =&gt; -1 [ssl_verify_result] =&gt; 0 [redirect_count] =&gt; 0 [total_time] =&gt; 0.206787 [namelookup_time] =&gt; 4.3E-5 [connect_time] =&gt; 0.034345 [pretransfer_time] =&gt; 0.07166 [size_upload] =&gt; 124 [size_download] =&gt; 818 [speed_download] =&gt; 3955 [speed_upload] =&gt; 599 [download_content_length] =&gt; 818 [upload_content_length] =&gt; 0 [starttransfer_time] =&gt; 0.20675 [redirect_time] =&gt; 0 [certinfo] =&gt; Array ( ) ) </code></pre> <p>and the second one, missing metadata: </p> <pre><code>Array ( [url] =&gt; http://tables.googlelabs.com/api/query [content_type] =&gt; [http_code] =&gt; 411 [header_size] =&gt; 0 [request_size] =&gt; 538 [filetime] =&gt; -1 [ssl_verify_result] =&gt; 0 [redirect_count] =&gt; 0 [total_time] =&gt; 0.107731 [namelookup_time] =&gt; 0.000849 [connect_time] =&gt; 0.054077 [pretransfer_time] =&gt; 0.054085 [size_upload] =&gt; 97 [size_download] =&gt; 0 [speed_download] =&gt; 0 [speed_upload] =&gt; 900 [download_content_length] =&gt; -1 [upload_content_length] =&gt; 0 [starttransfer_time] =&gt; 0.107711 [redirect_time] =&gt; 0 [certinfo] =&gt; Array ( ) ) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload