1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* OpenWeatherMap-PHP-API — A php api to parse weather data from http://www.OpenWeatherMap.org . |
4
|
|
|
* |
5
|
|
|
* @license MIT |
6
|
|
|
* |
7
|
|
|
* Please see the LICENSE file distributed with this source code for further |
8
|
|
|
* information regarding copyright and licensing. |
9
|
|
|
* |
10
|
|
|
* Please visit the following links to read about the usage policies and the license of |
11
|
|
|
* OpenWeatherMap before using this class: |
12
|
|
|
* |
13
|
|
|
* @see http://www.OpenWeatherMap.org |
14
|
|
|
* @see http://www.OpenWeatherMap.org/terms |
15
|
|
|
* @see http://openweathermap.org/appid |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
namespace Cmfcmf\OpenWeatherMap\Tests; |
19
|
|
|
|
20
|
|
|
use Cmfcmf\OpenWeatherMap\Fetcher\FetcherInterface; |
21
|
|
|
|
22
|
|
|
class TestFetcher implements FetcherInterface |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* Fetch contents from the specified url. |
26
|
|
|
* |
27
|
|
|
* @param string $url The url to be fetched. |
28
|
|
|
* |
29
|
|
|
* @return string The fetched content. |
30
|
|
|
* |
31
|
|
|
* @api |
32
|
|
|
*/ |
33
|
|
|
public function fetch($url) |
34
|
|
|
{ |
35
|
|
|
$format = strpos($url, 'json') !== false ? 'json' : 'xml'; |
36
|
|
|
if (strpos($url, 'forecast') !== false) { |
37
|
|
|
return $this->forecast($format); |
38
|
|
|
} else if (strpos($url, 'group') !== false) { |
39
|
|
|
return $this->group($format); |
40
|
|
|
} else { |
41
|
|
|
return $this->currentWeather($format); |
42
|
|
|
} |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
private function currentWeather($format) |
46
|
|
|
{ |
47
|
|
|
if ($format == 'xml') { |
48
|
|
|
return <<<XML |
49
|
|
|
<current> |
50
|
|
|
<city id="2950159" name="Berlin"> |
51
|
|
|
<coord lon="13.41" lat="52.52"></coord> |
52
|
|
|
<country>DE</country> |
53
|
|
|
<sun rise="2017-01-02T07:16:51" set="2017-01-02T15:04:50"></sun> |
54
|
|
|
</city> |
55
|
|
|
<temperature value="36.48" min="35.6" max="37.4" unit="fahrenheit"></temperature> |
56
|
|
|
<humidity value="86" unit="%"></humidity> |
57
|
|
|
<pressure value="1014" unit="hPa"></pressure> |
58
|
|
|
<wind> |
59
|
|
|
<speed value="9.17" name="Fresh Breeze"></speed> |
60
|
|
|
<gusts></gusts> |
61
|
|
|
<direction value="300" code="WNW" name="West-northwest"></direction> |
62
|
|
|
</wind> |
63
|
|
|
<clouds value="75" name="broken clouds"></clouds> |
64
|
|
|
<visibility value="8000"></visibility> |
65
|
|
|
<precipitation mode="no"></precipitation> |
66
|
|
|
<weather number="500" value="light rain" icon="10d"></weather> |
67
|
|
|
<lastupdate value="2017-01-02T12:20:00"></lastupdate> |
68
|
|
|
</current> |
69
|
|
|
XML; |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
private function forecast($format) |
74
|
|
|
{ |
75
|
|
|
if ($format == 'xml') { |
76
|
|
|
return <<<XML |
77
|
|
|
<weatherdata><location><name>Berlin</name><type></type><country>DE</country><timezone></timezone><location altitude="0" latitude="52.5244" longitude="13.4105" geobase="geonames" geobaseid="2950159"></location></location><credit></credit><meta><lastupdate></lastupdate><calctime>0.0052</calctime><nextupdate></nextupdate></meta><sun rise="2017-01-02T07:16:52" set="2017-01-02T15:04:49"></sun><forecast><time from="2017-01-02T09:00:00" to="2017-01-02T12:00:00"><symbol number="500" name="light rain" var="10d"></symbol><precipitation unit="3h" value="0.035" type="rain"></precipitation><windDirection deg="305.001" code="NW" name="Northwest"></windDirection><windSpeed mps="10.02" name="Fresh Breeze"></windSpeed><temperature unit="imperial" value="36.48" min="36.41" max="36.48"></temperature><pressure unit="hPa" value="1021.44"></pressure><humidity value="96" unit="%"></humidity><clouds value="overcast clouds" all="88" unit="%"></clouds></time><time from="2017-01-02T12:00:00" to="2017-01-02T15:00:00"><symbol number="500" name="light rain" var="10d"></symbol><precipitation unit="3h" value="0.02" type="rain"></precipitation><windDirection deg="322.003" code="NW" name="Northwest"></windDirection><windSpeed mps="8.32" name="Fresh Breeze"></windSpeed><temperature unit="imperial" value="34.83" min="34.78" max="34.83"></temperature><pressure unit="hPa" value="1022.88"></pressure><humidity value="93" unit="%"></humidity><clouds value="overcast clouds" all="88" unit="%"></clouds></time><time from="2017-01-02T15:00:00" to="2017-01-02T18:00:00"><symbol number="500" name="light rain" var="10n"></symbol><precipitation unit="3h" value="0.01" type="rain"></precipitation><windDirection deg="314.502" code="NW" name="Northwest"></windDirection><windSpeed mps="6.17" name="Moderate breeze"></windSpeed><temperature unit="imperial" value="32.59" min="32.55" max="32.59"></temperature><pressure unit="hPa" value="1024.51"></pressure><humidity value="89" unit="%"></humidity><clouds value="broken clouds" all="64" unit="%"></clouds></time><time from="2017-01-02T18:00:00" to="2017-01-02T21:00:00"><symbol number="802" name="scattered clouds" var="03n"></symbol><precipitation></precipitation><windDirection deg="274.003" code="W" name="West"></windDirection><windSpeed mps="7.99" name=""></windSpeed><temperature unit="imperial" value="29.41" min="29.38" max="29.41"></temperature><pressure unit="hPa" value="1025.89"></pressure><humidity value="93" unit="%"></humidity><clouds value="scattered clouds" all="32" unit="%"></clouds></time><time from="2017-01-02T21:00:00" to="2017-01-03T00:00:00"><symbol number="800" name="clear sky" var="01n"></symbol><precipitation></precipitation><windDirection deg="260.001" code="W" name="West"></windDirection><windSpeed mps="9.4" name="Fresh Breeze"></windSpeed><temperature unit="imperial" value="26.71" min="26.7" max="26.71"></temperature><pressure unit="hPa" value="1026.66"></pressure><humidity value="87" unit="%"></humidity><clouds value="clear sky" all="0" unit="%"></clouds></time><time from="2017-01-03T00:00:00" to="2017-01-03T03:00:00"><symbol number="802" name="scattered clouds" var="03n"></symbol><precipitation></precipitation><windDirection deg="251" code="WSW" name="West-southwest"></windDirection><windSpeed mps="9.95" name="Fresh Breeze"></windSpeed><temperature unit="imperial" value="26.16" min="26.16" max="26.16"></temperature><pressure unit="hPa" value="1026.35"></pressure><humidity value="89" unit="%"></humidity><clouds value="scattered clouds" all="36" unit="%"></clouds></time><time from="2017-01-03T03:00:00" to="2017-01-03T06:00:00"><symbol number="600" name="light snow" var="13n"></symbol><precipitation unit="3h" value="0.3225" type="snow"></precipitation><windDirection deg="241.502" code="WSW" name="West-southwest"></windDirection><windSpeed mps="10.76" name=""></windSpeed><temperature unit="imperial" value="29.84" min="29.84" max="29.84"></temperature><pressure unit="hPa" value="1025.26"></pressure><humidity value="97" unit="%"></humidity><clouds value="overcast clouds" all="92" unit="%"></clouds></time><time from="2017-01-03T06:00:00" to="2017-01-03T09:00:00"><symbol number="500" name="light rain" var="10d"></symbol><precipitation unit="3h" value="0.18" type="rain"></precipitation><windDirection deg="270.502" code="W" name="West"></windDirection><windSpeed mps="16.04" name="High wind, near gale"></windSpeed><temperature unit="imperial" value="35.02" min="35.02" max="35.02"></temperature><pressure unit="hPa" value="1024.19"></pressure><humidity value="95" unit="%"></humidity><clouds value="overcast clouds" all="92" unit="%"></clouds></time><time from="2017-01-03T09:00:00" to="2017-01-03T12:00:00"><symbol number="500" name="light rain" var="10d"></symbol><precipitation unit="3h" value="0.89" type="rain"></precipitation><windDirection deg="269.5" code="W" name="West"></windDirection><windSpeed mps="19.37" name="Gale"></windSpeed><temperature unit="imperial" value="38.25" min="38.25" max="38.25"></temperature><pressure unit="hPa" value="1023.07"></pressure><humidity value="96" unit="%"></humidity><clouds value="overcast clouds" all="92" unit="%"></clouds></time><time from="2017-01-03T12:00:00" to="2017-01-03T15:00:00"><symbol number="500" name="light rain" var="10d"></symbol><precipitation unit="3h" value="1.2" type="rain"></precipitation><windDirection deg="267" code="W" name="West"></windDirection><windSpeed mps="21.43" name="Severe Gale"></windSpeed><temperature unit="imperial" value="37.9" min="37.9" max="37.9"></temperature><pressure unit="hPa" value="1021.11"></pressure><humidity value="95" unit="%"></humidity><clouds value="overcast clouds" all="92" unit="%"></clouds></time><time from="2017-01-03T15:00:00" to="2017-01-03T18:00:00"><symbol number="500" name="light rain" var="10n"></symbol><precipitation unit="3h" value="0.6" type="rain"></precipitation><windDirection deg="263.501" code="W" name="West"></windDirection><windSpeed mps="24.18" name="Severe Gale"></windSpeed><temperature unit="imperial" value="38.66" min="38.66" max="38.66"></temperature><pressure unit="hPa" value="1018.81"></pressure><humidity value="94" unit="%"></humidity><clouds value="overcast clouds" all="92" unit="%"></clouds></time><time from="2017-01-03T18:00:00" to="2017-01-03T21:00:00"><symbol number="500" name="light rain" var="10n"></symbol><precipitation unit="3h" value="0.7" type="rain"></precipitation><windDirection deg="260.001" code="W" name="West"></windDirection><windSpeed mps="25.77" name="Storm"></windSpeed><temperature unit="imperial" value="38.48" min="38.48" max="38.48"></temperature><pressure unit="hPa" value="1016.13"></pressure><humidity value="94" unit="%"></humidity><clouds value="overcast clouds" all="92" unit="%"></clouds></time><time from="2017-01-03T21:00:00" to="2017-01-04T00:00:00"><symbol number="500" name="light rain" var="10n"></symbol><precipitation unit="3h" value="0.95" type="rain"></precipitation><windDirection deg="260.505" code="W" name="West"></windDirection><windSpeed mps="27.09" name="Storm"></windSpeed><temperature unit="imperial" value="39.61" min="39.61" max="39.61"></temperature><pressure unit="hPa" value="1012.58"></pressure><humidity value="96" unit="%"></humidity><clouds value="overcast clouds" all="92" unit="%"></clouds></time><time from="2017-01-04T00:00:00" to="2017-01-04T03:00:00"><symbol number="500" name="light rain" var="10n"></symbol><precipitation unit="3h" value="1.25" type="rain"></precipitation><windDirection deg="271" code="W" name="West"></windDirection><windSpeed mps="26.06" name="Storm"></windSpeed><temperature unit="imperial" value="42.08" min="42.08" max="42.08"></temperature><pressure unit="hPa" value="1008.96"></pressure><humidity value="95" unit="%"></humidity><clouds value="overcast clouds" all="92" unit="%"></clouds></time><time from="2017-01-04T03:00:00" to="2017-01-04T06:00:00"><symbol number="500" name="light rain" var="10n"></symbol><precipitation unit="3h" value="2.44" type="rain"></precipitation><windDirection deg="296.5" code="WNW" name="West-northwest"></windDirection><windSpeed mps="21.59" name="Severe Gale"></windSpeed><temperature unit="imperial" value="40.78" min="40.78" max="40.78"></temperature><pressure unit="hPa" value="1007.64"></pressure><humidity value="98" unit="%"></humidity><clouds value="broken clouds" all="80" unit="%"></clouds></time><time from="2017-01-04T06:00:00" to="2017-01-04T09:00:00"><symbol number="500" name="light rain" var="10d"></symbol><precipitation unit="3h" value="0.0099999999999998" type="rain"></precipitation><windDirection deg="286.001" code="WNW" name="West-northwest"></windDirection><windSpeed mps="23.55" name="Severe Gale"></windSpeed><temperature unit="imperial" value="39.06" min="39.06" max="39.06"></temperature><pressure unit="hPa" value="1006.86"></pressure><humidity value="91" unit="%"></humidity><clouds value="scattered clouds" all="44" unit="%"></clouds></time><time from="2017-01-04T09:00:00" to="2017-01-04T12:00:00"><symbol number="500" name="light rain" var="10d"></symbol><precipitation unit="3h" value="1.44" type="rain"></precipitation><windDirection deg="282" code="WNW" name="West-northwest"></windDirection><windSpeed mps="28.99" name="Violent Storm"></windSpeed><temperature unit="imperial" value="39.15" min="39.15" max="39.15"></temperature><pressure unit="hPa" value="1004.46"></pressure><humidity value="95" unit="%"></humidity><clouds value="overcast clouds" all="92" unit="%"></clouds></time><time from="2017-01-04T12:00:00" to="2017-01-04T15:00:00"><symbol number="500" name="light rain" var="10d"></symbol><precipitation unit="3h" value="1.39" type="rain"></precipitation><windDirection deg="298.504" code="WNW" name="West-northwest"></windDirection><windSpeed mps="21.85" name="Severe Gale"></windSpeed><temperature unit="imperial" value="38.19" min="38.19" max="38.19"></temperature><pressure unit="hPa" value="1004.41"></pressure><humidity value="98" unit="%"></humidity><clouds value="overcast clouds" all="88" unit="%"></clouds></time><time from="2017-01-04T15:00:00" to="2017-01-04T18:00:00"><symbol number="500" name="light rain" var="10n"></symbol><precipitation unit="3h" value="0.020000000000001" type="rain"></precipitation><windDirection deg="309.504" code="NW" name="Northwest"></windDirection><windSpeed mps="19.19" name="Gale"></windSpeed><temperature unit="imperial" value="35.59" min="35.59" max="35.59"></temperature><pressure unit="hPa" value="1007.27"></pressure><humidity value="89" unit="%"></humidity><clouds value="scattered clouds" all="36" unit="%"></clouds></time><time from="2017-01-04T18:00:00" to="2017-01-04T21:00:00"><symbol number="500" name="light rain" var="10n"></symbol><precipitation unit="3h" value="0.46" type="rain"></precipitation><windDirection deg="336.007" code="NNW" name="North-northeast"></windDirection><windSpeed mps="17.47" name="Gale"></windSpeed><temperature unit="imperial" value="34.31" min="34.31" max="34.31"></temperature><pressure unit="hPa" value="1010.75"></pressure><humidity value="94" unit="%"></humidity><clouds value="few clouds" all="20" unit="%"></clouds></time><time from="2017-01-04T21:00:00" to="2017-01-05T00:00:00"><symbol number="500" name="light rain" var="10n"></symbol><precipitation unit="3h" value="0.11" type="rain"></precipitation><windDirection deg="3.50226" code="N" name="North"></windDirection><windSpeed mps="17.83" name="Gale"></windSpeed><temperature unit="imperial" value="34.94" min="34.94" max="34.94"></temperature><pressure unit="hPa" value="1016.37"></pressure><humidity value="94" unit="%"></humidity><clouds value="broken clouds" all="80" unit="%"></clouds></time><time from="2017-01-05T00:00:00" to="2017-01-05T03:00:00"><symbol number="500" name="light rain" var="10n"></symbol><precipitation unit="3h" value="0.020000000000001" type="rain"></precipitation><windDirection deg="6.00137" code="N" name="North"></windDirection><windSpeed mps="14.36" name="High wind, near gale"></windSpeed><temperature unit="imperial" value="33.72" min="33.72" max="33.72"></temperature><pressure unit="hPa" value="1021.84"></pressure><humidity value="90" unit="%"></humidity><clouds value="scattered clouds" all="44" unit="%"></clouds></time><time from="2017-01-05T03:00:00" to="2017-01-05T06:00:00"><symbol number="800" name="clear sky" var="01n"></symbol><precipitation unit="3h" value="0.015" type="snow"></precipitation><windDirection deg="353.003" code="" name=""></windDirection><windSpeed mps="11.32" name="Strong breeze"></windSpeed><temperature unit="imperial" value="32.16" min="32.16" max="32.16"></temperature><pressure unit="hPa" value="1026.28"></pressure><humidity value="91" unit="%"></humidity><clouds value="overcast clouds" all="88" unit="%"></clouds></time><time from="2017-01-05T06:00:00" to="2017-01-05T09:00:00"><symbol number="600" name="light snow" var="13d"></symbol><precipitation unit="3h" value="0.07" type="snow"></precipitation><windDirection deg="347.5" code="NNW" name="North-northeast"></windDirection><windSpeed mps="9.75" name="Fresh Breeze"></windSpeed><temperature unit="imperial" value="32.4" min="32.4" max="32.4"></temperature><pressure unit="hPa" value="1030.43"></pressure><humidity value="95" unit="%"></humidity><clouds value="broken clouds" all="80" unit="%"></clouds></time><time from="2017-01-05T09:00:00" to="2017-01-05T12:00:00"><symbol number="800" name="clear sky" var="01d"></symbol><precipitation unit="3h" value="0.0049999999999999" type="snow"></precipitation><windDirection deg="348.011" code="NNW" name="North-northeast"></windDirection><windSpeed mps="10.76" name=""></windSpeed><temperature unit="imperial" value="34.4" min="34.4" max="34.4"></temperature><pressure unit="hPa" value="1033.21"></pressure><humidity value="96" unit="%"></humidity><clouds value="scattered clouds" all="36" unit="%"></clouds></time><time from="2017-01-05T12:00:00" to="2017-01-05T15:00:00"><symbol number="800" name="clear sky" var="02d"></symbol><precipitation></precipitation><windDirection deg="351.003" code="" name=""></windDirection><windSpeed mps="10.2" name="Fresh Breeze"></windSpeed><temperature unit="imperial" value="31.54" min="31.54" max="31.54"></temperature><pressure unit="hPa" value="1035.8"></pressure><humidity value="91" unit="%"></humidity><clouds value="clear sky" all="8" unit="%"></clouds></time><time from="2017-01-05T15:00:00" to="2017-01-05T18:00:00"><symbol number="800" name="clear sky" var="01n"></symbol><precipitation unit="3h" value="0.0049999999999999" type="snow"></precipitation><windDirection deg="351.503" code="" name=""></windDirection><windSpeed mps="10.2" name="Fresh Breeze"></windSpeed><temperature unit="imperial" value="27.33" min="27.33" max="27.33"></temperature><pressure unit="hPa" value="1038.82"></pressure><humidity value="89" unit="%"></humidity><clouds value="few clouds" all="12" unit="%"></clouds></time><time from="2017-01-05T18:00:00" to="2017-01-05T21:00:00"><symbol number="802" name="scattered clouds" var="03n"></symbol><precipitation></precipitation><windDirection deg="350.5" code="" name=""></windDirection><windSpeed mps="9.44" name="Fresh Breeze"></windSpeed><temperature unit="imperial" value="25.47" min="25.47" max="25.47"></temperature><pressure unit="hPa" value="1041.13"></pressure><humidity value="86" unit="%"></humidity><clouds value="scattered clouds" all="32" unit="%"></clouds></time><time from="2017-01-05T21:00:00" to="2017-01-06T00:00:00"><symbol number="800" name="clear sky" var="02n"></symbol><precipitation></precipitation><windDirection deg="349.5" code="" name=""></windDirection><windSpeed mps="8.72" name="Fresh Breeze"></windSpeed><temperature unit="imperial" value="23.91" min="23.91" max="23.91"></temperature><pressure unit="hPa" value="1042.86"></pressure><humidity value="88" unit="%"></humidity><clouds value="clear sky" all="8" unit="%"></clouds></time><time from="2017-01-06T00:00:00" to="2017-01-06T03:00:00"><symbol number="800" name="clear sky" var="01n"></symbol><precipitation></precipitation><windDirection deg="332" code="NNW" name="North-northeast"></windDirection><windSpeed mps="6.51" name="Moderate breeze"></windSpeed><temperature unit="imperial" value="21.04" min="21.04" max="21.04"></temperature><pressure unit="hPa" value="1044.05"></pressure><humidity value="86" unit="%"></humidity><clouds value="clear sky" all="0" unit="%"></clouds></time><time from="2017-01-06T03:00:00" to="2017-01-06T06:00:00"><symbol number="800" name="clear sky" var="01n"></symbol><precipitation></precipitation><windDirection deg="263.001" code="W" name="West"></windDirection><windSpeed mps="4.52" name="Gentle Breeze"></windSpeed><temperature unit="imperial" value="19.75" min="19.75" max="19.75"></temperature><pressure unit="hPa" value="1044.31"></pressure><humidity value="82" unit="%"></humidity><clouds value="clear sky" all="0" unit="%"></clouds></time><time from="2017-01-06T06:00:00" to="2017-01-06T09:00:00"><symbol number="800" name="clear sky" var="02d"></symbol><precipitation></precipitation><windDirection deg="249.502" code="WSW" name="West-southwest"></windDirection><windSpeed mps="7.87" name="Moderate breeze"></windSpeed><temperature unit="imperial" value="22.56" min="22.56" max="22.56"></temperature><pressure unit="hPa" value="1043.75"></pressure><humidity value="89" unit="%"></humidity><clouds value="clear sky" all="8" unit="%"></clouds></time><time from="2017-01-06T09:00:00" to="2017-01-06T12:00:00"><symbol number="500" name="light rain" var="10d"></symbol><precipitation unit="3h" value="0.0024999999999995" type="rain"></precipitation><windDirection deg="231.501" code="SW" name="Southwest"></windDirection><windSpeed mps="11.9" name="Strong breeze"></windSpeed><temperature unit="imperial" value="28.53" min="28.53" max="28.53"></temperature><pressure unit="hPa" value="1040.76"></pressure><humidity value="97" unit="%"></humidity><clouds value="clear sky" all="8" unit="%"></clouds></time><time from="2017-01-06T12:00:00" to="2017-01-06T15:00:00"><symbol number="802" name="scattered clouds" var="03d"></symbol><precipitation></precipitation><windDirection deg="229.015" code="SW" name="Southwest"></windDirection><windSpeed mps="14.61" name="High wind, near gale"></windSpeed><temperature unit="imperial" value="28.4" min="28.4" max="28.4"></temperature><pressure unit="hPa" value="1036.97"></pressure><humidity value="88" unit="%"></humidity><clouds value="scattered clouds" all="44" unit="%"></clouds></time><time from="2017-01-06T15:00:00" to="2017-01-06T18:00:00"><symbol number="600" name="light snow" var="13n"></symbol><precipitation unit="3h" value="0.14" type="snow"></precipitation><windDirection deg="236.001" code="SW" name="Southwest"></windDirection><windSpeed mps="19.04" name="Gale"></windSpeed><temperature unit="imperial" value="30.39" min="30.39" max="30.39"></temperature><pressure unit="hPa" value="1031.71"></pressure><humidity value="92" unit="%"></humidity><clouds value="overcast clouds" all="88" unit="%"></clouds></time><time from="2017-01-06T18:00:00" to="2017-01-06T21:00:00"><symbol number="500" name="light rain" var="10n"></symbol><precipitation unit="3h" value="0.3625" type="rain"></precipitation><windDirection deg="252.5" code="WSW" name="West-southwest"></windDirection><windSpeed mps="23.76" name="Severe Gale"></windSpeed><temperature unit="imperial" value="35.32" min="35.32" max="35.32"></temperature><pressure unit="hPa" value="1026.8"></pressure><humidity value="94" unit="%"></humidity><clouds value="overcast clouds" all="92" unit="%"></clouds></time></forecast></weatherdata> |
78
|
|
|
XML; |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
private function group($format) |
83
|
|
|
{ |
84
|
|
|
if ($format == 'json') { |
85
|
|
|
return <<<JSON |
86
|
|
|
{"cnt":1,"list":[{"coord":{"lon":13.41,"lat":52.52},"sys":{"type":1,"id":4892,"message":0.2862,"country":"DE","sunrise":1483341411,"sunset":1483369490},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"main":{"temp":36.48,"pressure":1014,"humidity":86,"temp_min":35.6,"temp_max":37.4},"visibility":8000,"wind":{"speed":9.17,"deg":300},"clouds":{"all":75},"dt":1483362571,"id":2950159,"name":"Berlin"}]} |
87
|
|
|
JSON; |
88
|
|
|
|
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
} |
92
|
|
|
|