I am trying to update Google fussion table through a php post request. URL works perfectly fine on Auth PlayGround. See the image below. Sorry! Stack overflow is not allowing me to post image, please use this link Image
But when I try the same using php post request file_get_content, it shoots with an error "411 Length Required". What length is the code asking for. Obviously its not content length because its "Zero" in this case.
<?php
$url = https://www.googleapis.com/fusiontables/v1/query?sql=INSERT INTO 1f_Z_********bQ-br8g17rFWBknri03fz-EQc (Name, Phone) VALUES ('Anees Hameed', '9895435751')
$Post = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/json',
'header' => 'GData Version: 3.0',
'header' => 'Authorization: Bearer '.$_Session[access_token]
)
);
$Post= stream_context_create($Post);
$request = file_get_content($url, false, $Post);
?>
How to get rid of this error.
First of all what's that URL in your code?! and you didn't wrapped it within quotes either.
and your code: