dave-cz

Untitled

Jul 2nd, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.33 KB | None | 0 0
  1. <?php
  2.  
  3. $soapClient = new SoapClient('http://weather.rcware.eu:9876/WeatherForecast',
  4.     array('trace' => 1)); // for debugging: trace = 1
  5.  
  6. $license = 'myCompanyPrivateLicense'; // sorry, i can't public this
  7. $forecastPointId = 1;
  8. $timeStep = 3600; // seconds
  9.  
  10. $utcTZ = new DateTimezone('UTC');
  11. $localTZ = new DateTimezone('Europe/Prague');
  12.  
  13. $utcFrom =  new DateTime('-12hours', $utcTZ );
  14. $utcTo =  new DateTime('+12hours', $utcTZ );
  15.  
  16.  
  17. $output = $soapClient->GetWeatherDataInterval(array(
  18.         'license' =>  $license,
  19.         'forecastPointId' =>  $forecastPointId,
  20.         'begin' => $utcFrom->format('Y-m-d\TH:i:s\Z'),
  21.         'end' => $utcTo->format('Y-m-d\TH:i:s\Z'),
  22.         'timeStep' => $timeStep,
  23.         'variableCommonName'  => 'TMAX-2m')
  24.     )->GetWeatherDataIntervalResult->WeatherDataResponse;
  25.  
  26. echo '<pre>';
  27. var_dump($output);
  28. echo '</pre>';
  29.  
  30. /* dump:
  31.  
  32. array(24) {
  33.   [0]=>
  34.   object(stdClass)#8 (4) {
  35.     ["Quality"]=>
  36.     float(0)
  37.     ["TimeStamp"]=>
  38.     string(20) "2013-07-01T18:58:49Z"
  39.     ["Unit"]=>
  40.     string(0) ""
  41.     ["Value"]=>
  42.     float(20.097805344973)
  43.   }
  44.   [1]=>
  45.   object(stdClass)#9 (4) {
  46.     ["Quality"]=>
  47.     float(0)
  48.     ["TimeStamp"]=>
  49.     string(20) "2013-07-01T19:58:49Z"
  50.     ["Unit"]=>
  51.     string(0) ""
  52.     ["Value"]=>
  53.     float(19.062260041762)
  54.   }
  55.  
  56.   ...
  57. */
  58.  
  59. ?>
Advertisement
Add Comment
Please, Sign In to add comment