Ski Resort Desk Snow Meter (Snowbird)

Step 5: Bonus Feature: Twilio

Picture of Bonus Feature: Twilio
PHP Script with Twilio output:
// create curl resource
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, "");
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$output = curl_exec($ch);
// close curl resource to free up system resources

$output = trim($output);
$twentyfour = explode('24hr:<b><font color="FBE075">',$output);
$twentyfour = explode('</font></b>',$twentyfour[1]);

$fortyeight = explode('48hr:<b><font color="FBE075">', $output);
$fortyeight = explode('</font></b>',$fortyeight[1]);

$ytd = explode('YTD:<b><font color="FBE075">', $output);
$ytd = explode('</font></b>',$ytd[1]);

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<Response><Say>Snowbird Resort had " . $twentyfour[0] . " inches in the last twenty four hours, " . $fortyeight[0] . " inches in the last forty eight hours, and " .$ytd[0]. " inches year to date.</Say></Response>";
Remove these adsRemove these ads by Signing Up

Get More Out of Instructables

Already have an Account?


PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!