PHPMine
<? if(PHP > $Expectations) echo $Results ?>
by Angel S. Moreno
UNDER SOME SERIOUS CONSTRUCTION LINKS MAY NOT WORK
Asked 2010-03-08 22:13:37 by Four
I need to write a script that will output the current temperature from the Chicago Du page airport. I figure that I need to make some sort of script based on this site:
http://www.weather.gov/xml/current_obs/KDPA.xml
I just don't know where to really start and am starting to pull my hair out. I just can't seem to get this off the ground. I keep getting an error for my variable on line 5 but I don't know what I am doing wrong. Here is my current script:
<?php
$dd = new DOMDocument
$dd->load("http://www.weather.gov/xml
/current_obs/KDPA.xml");
$xp = new DOMXPath($dd);
$weather = $xp->query('//current_observation
/weather')->item(0)->nodeValue;
$temperature = $xp->query('//current_observation
/temp_f' )->item(0)->nodeValue;
echo "Chicago Dupage airport weather
Conditions: $weather
Current Temperature: $temperature degrees F";
?>
I had to break up a few of the lines because yahoo didn't want them posted in their original form I guess but everything is there. If someone could load this into Notepadd++ and see what they get I would be extremely grateful.
Anwered 2010-03-08 22:28:10 by Chris C
The only thing that stands out right away is the first line. There is no semicolon at the end, like this:
$dd = new DOMDocument();
instead of:
$dd = new DOMDocument
Questions and answers provided by the Yahoo Answers Community.