Skip to content

Instantly share code, notes, and snippets.

@Reldas
Reldas / GoogleHomeRedirect.php
Created January 18, 2018 18:53
Redirect request from Google Home to Google Apps Script and pass back the result
<?php
function http_post($url, $data)
{
$data_url=$data;
$data_len = strlen ($data_url);
return array ('content'=>file_get_contents ($url, false, stream_context_create (array ('http'=>array ('method'=>'POST'
,'header' => "Content-type: application/x-www-form-urlencoded\r\n"
, 'content'=>$data_url
))))
, 'headers'=>$http_response_header