Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8" />
- <title>Weather - Jake Spurlock</title>
- <meta name="generator" content="BBEdit 9.6" />
- <link href='http://fonts.googleapis.com/css?family=Slackey' rel='stylesheet' type='text/css'>
- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
- <script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
- <script src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
- </head>
- <body>
- <div data-role="page">
- <div id="header" data-role="header">
- <?php
- if ($_POST) {
- $request_url = 'http://www.google.com/ig/api?weather='.urlencode($_POST['zip']);
- $xml = simplexml_load_file($request_url) or die("feed not loading");
- ?>
- <h1><?php echo $xml->weather[0]->forecast_information[0]->city['data']; ?></h1>
- <?php }
- else {
- ?>
- <h1>Weather</h1>
- <?php } ?>
- </div>
- <div data-role="content" id="content">
- <?php if (!$_POST) { ?>
- <form action="" method="post">
- Zip Code: <input type="text" name="zip" /><br />
- <input type="submit" name="submit" value="Submit me!" />
- </form>
- <?php } ?>
- <?php
- if ($_POST) {
- error_reporting(E_ALL);
- ?>
- <p>Currently, it is <?php echo strtolower($xml->weather[0]->current_conditions[0]->condition['data']); ?> with the temperature hovering around <?php echo $xml->weather[0]->current_conditions[0]->temp_f['data']; ?>.</p>
- <p>Today, it is going to be <?php echo strtolower($xml->weather[0]->forecast_conditions[0]->condition['data']); ?>, with a high around <?php echo $xml->weather[0]->forecast_conditions[0]->high['data']; ?> and dipping down to <?php echo $xml->weather[0]->forecast_conditions[0]->low['data']; ?>.</p>
- <?php } ?>
- <ul data-role="listview" data-inset="true">
- <li><a href="#two">Links</a></li>
- <li><a href="#one">Zip Code</a></li>
- </div>
- <div data-role="footer">
- <h4>© Jake Spurlock</h4>
- </div><!-- /footer -->
- </div>
- <div id="one" data-role="page">
- <div data-role="header">
- <h1>Zip Code</h1>
- </div>
- <div data-role="content">
- <p>Add your zip code to get at a glance weather.</p>
- <div data-role="fieldcontain">
- <label for="name">Enter Zip Code:</label>
- <input type="text" name="name" id="name" value="" />
- </div>
- </div>
- <div data-role="footer">
- <h4>© Jake Spurlock</h4>
- </div>
- </div>
- <div id="two" data-role="page">
- <div data-role="header">
- <h1>Links</h1>
- </div>
- <div data-role="content">
- <ul data-role="listview" data-inset="true">
- <li data-role="list-divider">Jake Spurlock Links</li>
- <li>Jake Spurlock.com</li>
- <li>SMRTDSGN.com</li>
- </ul>
- </div>
- <div data-role="footer">
- <h4>© Jake Spurlock</h4>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement