Skip to content

Instantly share code, notes, and snippets.

@Sam-Jenkins
Created April 4, 2017 21:19
Show Gist options
  • Save Sam-Jenkins/d229c780e21453b15b97ec127286a7ee to your computer and use it in GitHub Desktop.
Save Sam-Jenkins/d229c780e21453b15b97ec127286a7ee to your computer and use it in GitHub Desktop.
How far away is the moon?
<?php
// enter your RCA ID here
$id = 'ex4mp13-ex4mp13-ex4mp13-ex4mp13';
// get the data we need from the API
$data = file_get_contents('http://api.burningsoul.in/moon');
$objMoon = json_decode($data);
// package up the data to send to the RCA monitor
$payload = [
'id'=>$id,
'DFCOE'=>$objMoon->DFCOE,
'DFS'=>$objMoon->DFS
];
// POST the data to the RCA
$ch = curl_init('https://results.rapidspike.com/rca/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment