|
aohavkbs, http://www.tomshw.it/forum/members/buy-glucophage.html glucophage conveniente, tndgogaw, http://www.tomshw.it/forum/members/comprar-zyprexa.html zyprexa conveniente, vtyyhpgn, http://www.tomshw.it/forum/members/comprar-desyrel.html desyrel conveniente, fxjgwxxe, http://www.tomshw.it/forum/members/comprar-cytotec.html cytotec prezzo ridotto, sazxpbxj, |
Assignment2SamanthaDIY weather Online version: http://ernie.art.yale.edu/~samanthahaedrich/weatherdiy.php Source code: <html> <head> <title>Weather DIY Service</title> <style type="text/css"> body { margin: 140px 260px; font-family: "Courier"; font-size: 13px; line-height: 16px; } .form { font-family: "Courier"; font-size: 13px; width:100px; background-color:yellow; } .condition { background-color:yellow; } .city { background-color:#73CAFC; } .report { background-color:E2DFDF; } .large { font-size: 18px; background-color:yellow; } </style> </head> <body> <?php if (!isset($_REQUEST['zip'])) { ?> DIY Weather Service<br /><br /> <form action="samantha.php" action="get"> Enter zip <input class="form" type="text" name="zip"> </form> <?php } else { // ----- yahoo weather code $zipcode = $_REQUEST["zip"]; $yahoo_url = "http://xml.weather.yahoo.com/forecastrss?p=$zipcode"; $data = file_get_contents($yahoo_url); // reformat yahoo weather data $data = str_replace("yweather:", "", $data); $data = str_replace("geo:", "", $data); // load reformatted file into SimpleXML $xml_data = simplexml_load_string($data); $channel = $xml_data->channel; $location = $channel->location; $city = $location["city"]; // e.g. "New Haven" $item = $channel->item; $condition = $item->condition; $conditionText = $condition["text"]; // e.g. "Mostly Cloudy" (corresponds to code below) $conditionCode = $condition["code"]; // e.g. "26" (47 possibilities) $temp = $condition["temp"]; // e.g. 57 // ----- format city for google search $city_nospaces = str_replace(" ","+",$city); // ----- print greeting echo "DIY Weather Service<br /><br />"; $date = date('M d, Y'); $time = date('h:m'); $month = date('M'); echo "<span class=\"report\">This weather report was randomly generated $date at $time.</span> <span class=\"large\"><span class=\"city\">$city is $temp° F.</span></span> <span class=\"condition\">Your task is the $conditionText Assignment.</span> <span class=\"report\">I hope you are unprepared.</span> "; // ----- print random lyrics $lyrics_array = array( 1 => "Ain't no people on old dirt road, No more weather on the old dirt road. Its better than a mudslide, mama, when the dry spell come, yeah, Oh, oh, oh, oh, old dirt road.", 2 => "i have found what you are like the rain,// (Who feathers frightened fields// with the superior dust-of-sleep. wields// easily the pale club of the wind// and swirled justly souls of flower strike// the air in utterable coolness//", 3 => " Suddenly from all the green around you// something-you don't know// what-has disappeared;// you feel it creeping closer to the window// in total silence.", 4 => "GIVE me the splendid silent sun, with all his beams full-dazzling;// Give me juicy autumnal fruit, ripe and red from the orchard;// Give me a field where the unmow'd grass grows;// Give me an arbor, give me the trellis'd grape;// Give me fresh corn and wheat-give me serene-moving animals, teaching content;" ); $lyric_rand = rand(1,count($lyrics_array)); $lyric_rand = $lyrics_array[$lyric_rand]; echo "<em>$lyric_rand</em> "; echo "Okay. Find the nearest exit. <b>Head out</b>----->"; $place_array = array( 1 => 'picnic table', 2 => 'playground', 3 => 'parking garage', 4 => 'stop sign', 5 => 'municipal building', 6 => 'vacant', 7 => 'backyard ', 8 => 'dirt road', 9 => 'boat launch', 10 => 'diner', 11 => 'stoplight', 12 => 'wildlife refuge', 13 => 'no trespassing', 14 => 'police car', 15 => 'turn left', 16 => 'bicycle loop' ); $place_rand = rand(1,count($place_array)); $place_rand = $place_array[$place_rand]; $place_nospaces = str_replace(" ","+",$place_rand); // ----- google search $google_key = '9d/wzt5QFHLCSb/PTZbmdzBKzmkHnlxO'; $soap_url = "http://api.google.com/GoogleSearch.wsdl"; $query = "\"$city_nospaces\"+\"$place_nospaces\""; // SOAP client (remote method invocation) $client = new SoapClient($soap_url); $response = $client->doGoogleSearch( $google_key, $query, 0, // results index to start 10, // number of results (max 10) false, // don't filter similar results '', // no restricts false, // no SafeSearch filter '', // no language restricts '', // not used '' // not used ); if ($response->estimatedTotalResultsCount > 0) { $results_array = $response->resultElements; // choose which result to use $result = $results_array[3]; echo '<span class="city">'; echo strip_tags($result->snippet); echo "</span>"; } echo " "; // ----- print assignment based on conditionText $assignment_array = array( 1 => 'Head for the hills', 2 => 'storm', 3 => 'SAFETY SAFETY', 4 => 'lightning', 5 => 'lightning', 6 => 'rain,snow', 7 => 'sleet', 8 => 'ice', 9 => 'Make a sign that dissolves in the rain.', 10 => 'Make a sign that dissolves in the rain.', 11 => 'Make a sign that dissolves in the rain.', 12 => 'Draw a boundary. Watch the rain cross it again and again.', 13 => 'Use your body to make a sign that spells out trouble', 14 => 'Use your body to make a sign that spells out trouble', 15 => 'Use your body to make a sign that spells out trouble', 16 => 'Use your body to make a sign that spells out trouble', 17 => 'hail', 18 => 'sleet', 19 => 'Make something now visible invisible.', 20 => 'Make something now visible invisible.', 21 => 'Make something now visible invisible.', 22 => 'smoke', 23 => 'Draw some arrows. Let them loose. See where they lead you. ', 24 => 'Draw some arrows. Let them loose. See where they lead you.', 25 => 'ice', 26 => 'Make something large that blends into the environment. ', 27 => 'Make something large that blends into the environment. ', 28 => 'Make something large that blends into the environment. ', 29 => 'Make something large that blends into the environment. ', 30 => 'Make something large that blends into the environment. ', 31 => 'Find a cozy spot. Map a history of possible moments leading up to your presence. 10 minutes. +1 year. +1000 years.', 32 => 'Find a cozy spot. Map a history of possible moments leading up to your presence. 10 minutes. +1 year. +1000 years.', 33 => 'Find a cozy spot. Map a history of possible moments leading up to your presence. 10 minutes. +1 year. +1000 years.', 34 => 'Find a cozy spot. Map a history of possible moments leading up to your presence. 10 minutes. +1 year. +1000 years.', 35 => 'hail', 36 => 'Find a cozy spot. Map a history of possible moments leading up to your presence. 10 minutes. +1 year. +1000 years.', 37 => 'lightning', 38 => 'lightning', 39 => 'lightning', 40 => 'rain', 41 => 'Ruin the whitespace.', 42 => 'Ruin the whitespace.', 43 => 'Ruin the whitespace.', 44 => 'Make something now visible invisible.', 45 => 'lightning', 46 => 'lightning', 47 => 'storm' ); $do_assignment = $assignment_array["$conditionCode"]; echo "<span class=\"large\">$do_assignment</span><br /><br />"; // ----- print random assignment site $link_array = array( 1 => 'learningtoloveyoumore.com', 2 => 'www.designItyourself.org', 3 => 'www.readymademag.com/blog/', 4 => 'www.e-flux.com/projects/do_it/homepage/do_it_home.html' ); $site_rand = rand(1,count($link_array)); $site_rand = $link_array[$site_rand]; echo "Think not? Feel free to browse through these other <a href=\"http://$site_rand\">assignments</a>."; } ?> </body> </html> |