Skip to content

Instantly share code, notes, and snippets.

@stevelippert
Created May 10, 2014 18:54
Show Gist options
  • Select an option

  • Save stevelippert/eb39fb4830b88039fdd4 to your computer and use it in GitHub Desktop.

Select an option

Save stevelippert/eb39fb4830b88039fdd4 to your computer and use it in GitHub Desktop.
WeatherSTEM PHP API Example
<?php
$url = 'https://leonschools.weatherstem.com/api';
$vars = array(
"stations" => array("canopyoaks"),
"api_key" =>"cs9ynb6t"
);
$options = array(
'http' => array(
'method' => 'POST',
'content' => json_encode( $vars ),
'header' => "Content-Type: application/json\r\n" .
"Accept: application/json\r\n"
)
);
$context = stream_context_create( $options );
$result = file_get_contents( $url, false, $context );
$response = json_decode( $result );
print_r($response);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment