Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $soapClient = new SoapClient('http://weather.rcware.eu:9876/WeatherForecast',
- array('trace' => 1)); // for debugging: trace = 1
- $license = 'myCompanyPrivateLicense'; // sorry, i can't public this
- $forecastPointId = 1;
- $timeStep = 3600; // seconds
- $utcTZ = new DateTimezone('UTC');
- $localTZ = new DateTimezone('Europe/Prague');
- $utcFrom = new DateTime('-12hours', $utcTZ );
- $utcTo = new DateTime('+12hours', $utcTZ );
- $output = $soapClient->GetWeatherDataInterval(array(
- 'license' => $license,
- 'forecastPointId' => $forecastPointId,
- 'begin' => $utcFrom->format('Y-m-d\TH:i:s\Z'),
- 'end' => $utcTo->format('Y-m-d\TH:i:s\Z'),
- 'timeStep' => $timeStep,
- 'variableCommonName' => 'TMAX-2m')
- )->GetWeatherDataIntervalResult->WeatherDataResponse;
- echo '<pre>';
- var_dump($output);
- echo '</pre>';
- /* dump:
- array(24) {
- [0]=>
- object(stdClass)#8 (4) {
- ["Quality"]=>
- float(0)
- ["TimeStamp"]=>
- string(20) "2013-07-01T18:58:49Z"
- ["Unit"]=>
- string(0) ""
- ["Value"]=>
- float(20.097805344973)
- }
- [1]=>
- object(stdClass)#9 (4) {
- ["Quality"]=>
- float(0)
- ["TimeStamp"]=>
- string(20) "2013-07-01T19:58:49Z"
- ["Unit"]=>
- string(0) ""
- ["Value"]=>
- float(19.062260041762)
- }
- ...
- */
- ?>
Advertisement
Add Comment
Please, Sign In to add comment