Skip to content

Instantly share code, notes, and snippets.

@max-pub
Last active November 25, 2017 10:38
Show Gist options
  • Save max-pub/5d0cb5a0272607f274b0 to your computer and use it in GitHub Desktop.
Save max-pub/5d0cb5a0272607f274b0 to your computer and use it in GitHub Desktop.
PHP POST
<?
function post($url, $data){
$options = array(
'http' => array( // use key 'http' even if you send the request to https://...
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
// 'content' => json_encode($data),
),
);
$context = stream_context_create($options);
return file_get_contents($url, false, $context);
}
?>
@max-pub
Copy link
Author

max-pub commented Feb 2, 2016

  • a
  • b
<temperature-range data='[ {"min":10,"max":15}, ..., ...]'></temperature-range>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment