Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $pass = 'password'; //passvk
- $auth = curl( 'https://oauth.vk.com/token?grant_type=password&client_id=2274003&client_secret=hHbZxrka2uZ6jB1inYsH&username='. $login .'&password='. $pass ); //authorization
- $json = json_decode( $auth, true );
- $access_token = $json['access_token'];
- preg_match('/<td class="weather__temp"><span>(.*?)<\/span><\/td>/',file_get_contents('http://m.gismeteo.ua/weather/4951/'), $ter);
- $ter =$ter[1];//pars weather gismeteo.ua
- $statusSet = curl( 'https://api.vk.com/method/status.set?text='. urlencode( '⛅Погода:'.$ter ) .'&access_token='. $access_token );//status add
- function curl( $url ) {
- $ch = curl_init( $url );
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
- curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
- curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
- $response = curl_exec( $ch );
- curl_close( $ch );
- return $response;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment