Skip to content

Commit 1862b4e

Browse files
committed
Add example for icon usage, closes #89.
1 parent 2c051b5 commit 1862b4e

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

Examples/CurrentWeather.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -171,32 +171,39 @@
171171
echo 'Precipation: '.$weather->precipitation->getDescription().' ('.$weather->precipitation.')';
172172
echo "<br />\n";
173173

174-
// Example 10: Show copyright notice. WARNING: This is no offical text. This hint was created regarding to http://www.http://openweathermap.org/copyright .
174+
// Example 10: Show copyright notice. WARNING: This is no official text. This hint was created by looking at http://www.http://openweathermap.org/copyright .
175175
echo "<br /><br />\n\n\nEXAMPLE 10<hr />\n\n\n";
176176

177177
echo $owm::COPYRIGHT;
178178
echo "<br />\n";
179179

180-
// Example 11: Get raw xml data.
180+
// Example 11: Retrieve weather icons.
181181
echo "<br /><br />\n\n\nEXAMPLE 11<hr />\n\n\n";
182+
$weather = $owm->getWeather('Berlin');
183+
echo $weather->weather->icon;
184+
echo "<br />\n";
185+
echo $weather->weather->getIconUrl();
186+
187+
// Example 12: Get raw xml data.
188+
echo "<br /><br />\n\n\nEXAMPLE 12<hr />\n\n\n";
182189

183190
echo '<pre><code>'.htmlspecialchars($owm->getRawWeatherData('Berlin', $units, $lang, null, 'xml')).'</code></pre>';
184191
echo "<br />\n";
185192

186-
// Example 12: Get raw json data.
187-
echo "<br /><br />\n\n\nEXAMPLE 12<hr />\n\n\n";
193+
// Example 13: Get raw json data.
194+
echo "<br /><br />\n\n\nEXAMPLE 13<hr />\n\n\n";
188195

189196
echo '<code>'.htmlspecialchars($owm->getRawWeatherData('Berlin', $units, $lang, null, 'json')).'</code>';
190197
echo "<br />\n";
191198

192-
// Example 13: Get raw html data.
193-
echo "<br /><br />\n\n\nEXAMPLE 13<hr />\n\n\n";
199+
// Example 14: Get raw html data.
200+
echo "<br /><br />\n\n\nEXAMPLE 14<hr />\n\n\n";
194201

195202
echo $owm->getRawWeatherData('Berlin', $units, $lang, null, 'html');
196203
echo "<br />\n";
197204

198-
// Example 14: Error handling.
199-
echo "<br /><br />\n\n\nEXAMPLE 14<hr />\n\n\n";
205+
// Example 15: Error handling.
206+
echo "<br /><br />\n\n\nEXAMPLE 15<hr />\n\n\n";
200207

201208
// Try wrong city name.
202209
try {

0 commit comments

Comments
 (0)