Murove1

statusvk.set

Jan 15th, 2013
143
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. <?php
  3. $login = '[email protected]'; //Логин
  4. $pass = 'pass'; //Пароль
  5. $text = 'Text test!'; //Текс который нужен в статусе
  6. $auth = curl( 'https://oauth.vk.com/token?grant_type=password&client_id=2274003&client_secret=hHbZxrka2uZ6jB1inYsH&username='. $login .'&password='. $pass ); //Авторизация
  7. $json = json_decode( $auth, true );
  8. $access_token = $json['access_token'];
  9. echo "Статус установлен!";
  10. $statusSet = curl( 'https://api.vk.com/method/status.set?text='. urlencode( $text ) .'&access_token='. $access_token );//добавляем статус
  11. function curl( $url ) {
  12.         $ch = curl_init( $url );
  13.         curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
  14.         curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
  15.         curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
  16.         $response = curl_exec( $ch );
  17.         curl_close( $ch );
  18.         return $response;
  19. }
  20. ?>
  21. ###Начало php учения###
Advertisement
Add Comment
Please, Sign In to add comment