Step 5: Bonus Feature: Twilio

PHP Script with Twilio output:
// create curl resource
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, "http://www.snowbird.com/index.html");
//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>";
nice, although for us here in SLC its easier to look out the window...
That is when we can even see the mtns. :P<br>
I'm jealous!

About This Instructable




More by noelportugal:Halloween Pumpkin Pay - NFC Enabled Pumpkins ESP8266 Wifi Temperature Logger Interactive Magic Mirror with Candy Dispenser 
Add instructable to: