Advertisement
Guest User

Untitled

a guest
May 19th, 2016
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1. <?php
  2. $timestamp = time();
  3. $token = md5('eternalsun'.$timestamp);
  4.  
  5. $uuid = "8211637137c4408898aceb1097921872";
  6. $deviceid = "315f0e802b0b49eb8404ea8056abeaaf";
  7.  
  8. $opts = array(
  9.   'http'=>array(
  10.     'method'=>"GET",
  11.     'header'=>"User-Agent: yandex-weather-android/4.2.1\n" .
  12.                "X-Yandex-Weather-Client: YandexWeatherAndroid/4.2.1\n" .
  13.                "X-Yandex-Weather-Device: os=null;os_version=21;manufacturer=chromium;model=App Runtime for Chrome Dev;device_id=$deviceid;uuid=$uuid;\n" .
  14.                "X-Yandex-Weather-Token: $token\n" .
  15.                "X-Yandex-Weather-Timestamp: $timestamp\n" .
  16.                "X-Yandex-Weather-UUID: $uuid\n" .
  17.                "X-Yandex-Weather-Device-ID: $deviceid\n" .
  18.                "Accept-Encoding: gzip, deflate\n" .
  19.                "Host: api.weather.yandex.ru\n" .
  20.                "Connection: Keep-Alive"
  21.   )
  22. );
  23.  
  24. $context = stream_context_create($opts);
  25. $file = file_get_contents('https://api.weather.yandex.ru/v1/forecast?geoid=100471&lang=ru', false, $context);
  26.  
  27. header('Content-type: text/json');
  28. echo gzdecode($file);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement