Code: Select all
$xmlparser = xml_parser_create();
if (!xml_parse_into_struct($xmlparser, $this->_xml, $this->_values, $this->_indexes)) {
$this->_error = "Unparsable XML";
return(0);
}
xml_parser_free($xmlparser);Here is the output from the curl command:
en_US
MEDIUM
F mi mph in in Shawnee Mission, KS (66214) 11:45 AM 38.96 -94.71 7:21 AM 4:57 PM -6 http://www.weather.com/outlook/health/a ... 4?par=xoap Pollen Reports http://www.weather.com/outlook/travel/f ... 4?par=xoap Airport Delays http://www.weather.com/outlook/events/s ... k&par=xoap Special Events http://www.weather.com/services/desktop.html?par=xoap Download Desktop Weather 12/3/04 10:53 AM CST Olathe Executive, KS 41 36 Fair 34 30.06 falling 8 N/A 200 SSW 67 10.0 2 Low 31 20 Waning Gibbous 12/3/04 11:03 AM CST 44 32 7:21 AM 4:57 PM 30 Partly Cloudy 10 N/A 248 WSW 0 63 31 Clear 7 N/A 234 SW 0 81 52 42 7:22 AM 4:56 PM 32 Sunny 12 N/A 206 SSW 0 68 29 Partly Cloudy 11 N/A 181 S 0 77 54 40 7:23 AM 4:56 PM 11 Showers 13 N/A 172 S 60 81 29 Clouds Early / Clearing Late 7 N/A 197 SSW 10 85 51 28 7:24 AM 4:56 PM 30 Partly Cloudy 13 N/A 261 W 20 74 29 Partly Cloudy 10 N/A 313 NW 20 64
End output
the actual XML looks like this:
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--This document is intended only for use by authorized licensees of The Weather Channel. Unauthorized use is prohibited. Copyright 1995-2004, The Weather Channel Enterprises, Inc. All Rights Reserved.-->
<weather ver="2.0">
<head>
<locale>en_US</locale>
<form>MEDIUM</form>
<ut>F</ut>
<ud>mi</ud>
<us>mph</us>
<up>in</up>
<ur>in</ur>
</head>
<loc id="66214">
<dnam>Shawnee Mission, KS (66214)</dnam>
<tm>12:00 PM</tm>
<lat>38.96</lat>
<lon>-94.71</lon>
<sunr>7:21 AM</sunr>
<suns>4:57 PM</suns>
<zone>-6</zone>
</loc>
<lnks type="prmo">
<link pos="1">
<l>http://www.weather.com/outlook/health/allergies/66214?par=xoap</l>
<t>Pollen Reports</t>
</link>
<link pos="2">
<l>http://www.weather.com/outlook/travel/flights/citywx/66214?par=xoap</l>
<t>Airport Delays</t>
</link>
<link pos="3">
<l>http://www.weather.com/outlook/events/special/result/66214?when=thisweek&par=xoap</l>
<t>Special Events</t>
</link>
<link pos="4">
<l>http://www.weather.com/services/desktop.html?par=xoap</l>
<t>Download Desktop Weather</t>
</link>
</lnks>
<cc>
<lsup>12/3/04 11:53 AM CST</lsup>
<obst>Olathe Executive, KS</obst>
<tmp>42</tmp>
<flik>36</flik>
<t>Fair</t>
<icon>34</icon>
<bar>
<r>30.04</r>
<d>falling</d>
</bar>
<wind>
<s>10</s>
<gust>N/A</gust>
<d>230</d>
<t>SW</t>
</wind>
<hmid>62</hmid>
<vis>10.0</vis>
<uv>
<i>2</i>
<t>Low</t>
</uv>
<dewp>30</dewp>
<moon>
<icon>20</icon>
<t>Waning Gibbous</t>
</moon>
</cc>
<dayf>
<lsup>12/3/04 11:03 AM CST</lsup>
<day d="0" t="Friday" dt="Dec 3">
<hi>44</hi>
<low>32</low>
<sunr>7:21 AM</sunr>
<suns>4:57 PM</suns>
<part p="d">
<icon>30</icon>
<t>Partly Cloudy</t>
<wind>
<s>10</s>
<gust>N/A</gust>
<d>248</d>
<t>WSW</t>
</wind>
<ppcp>0</ppcp>
<hmid>63</hmid>
</part>
<part p="n">
<icon>31</icon>
<t>Clear</t>
<wind>
<s>7</s>
<gust>N/A</gust>
<d>234</d>
<t>SW</t>
</wind>
<ppcp>0</ppcp>
<hmid>81</hmid>
</part>
</day>
<day d="1" t="Saturday" dt="Dec 4">
<hi>52</hi>
<low>42</low>
<sunr>7:22 AM</sunr>
<suns>4:56 PM</suns>
<part p="d">
<icon>32</icon>
<t>Sunny</t>
<wind>
<s>12</s>
<gust>N/A</gust>
<d>206</d>
<t>SSW</t>
</wind>
<ppcp>0</ppcp>
<hmid>68</hmid>
</part>
<part p="n">
<icon>29</icon>
<t>Partly Cloudy</t>
<wind>
<s>11</s>
<gust>N/A</gust>
<d>181</d>
<t>S</t>
</wind>
<ppcp>0</ppcp>
<hmid>77</hmid>
</part>
</day>
<day d="2" t="Sunday" dt="Dec 5">
<hi>54</hi>
<low>40</low>
<sunr>7:23 AM</sunr>
<suns>4:56 PM</suns>
<part p="d">
<icon>11</icon>
<t>Showers</t>
<wind>
<s>13</s>
<gust>N/A</gust>
<d>172</d>
<t>S</t>
</wind>
<ppcp>60</ppcp>
<hmid>81</hmid>
</part>
<part p="n">
<icon>29</icon>
<t>Clouds Early / Clearing Late</t>
<wind>
<s>7</s>
<gust>N/A</gust>
<d>197</d>
<t>SSW</t>
</wind>
<ppcp>10</ppcp>
<hmid>85</hmid>
</part>
</day>
<day d="3" t="Monday" dt="Dec 6">
<hi>51</hi>
<low>28</low>
<sunr>7:24 AM</sunr>
<suns>4:56 PM</suns>
<part p="d">
<icon>30</icon>
<t>Partly Cloudy</t>
<wind>
<s>13</s>
<gust>N/A</gust>
<d>261</d>
<t>W</t>
</wind>
<ppcp>20</ppcp>
<hmid>74</hmid>
</part>
<part p="n">
<icon>29</icon>
<t>Partly Cloudy</t>
<wind>
<s>10</s>
<gust>N/A</gust>
<d>313</d>
<t>NW</t>
</wind>
<ppcp>20</ppcp>
<hmid>64</hmid>
</part>
</day>
</dayf>
</weather>I want to get at the XML and parse it and it is at a URL which is:
http://xoap.weather.com/weather/local/6 ... Key&unit=s
You need to get a license key and partner id to run this, but I thought it would help to see the URL that fetches the XML (obviously I took my info out for security reasons
Thanks for any help in advance.