Murove1

wall.post+factroom.ru

Jan 16th, 2013
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 KB | None | 0 0
  1. <?
  2. $login = 'login'; //Логин
  3. $pass = 'pass'; //Пароль
  4. $auth = curl( 'https://oauth.vk.com/token?grant_type=password&client_id=2274003&client_secret=hHbZxrka2uZ6jB1inYsH&username='. $login .'&password='. $pass ); //Авторизация
  5. $json = json_decode( $auth, true );
  6. $access_token = $json['access_token'];
  7. /*Парсим факт*/
  8. $pars_fact = file_get_contents ("http://factroom.ru/random/");
  9. preg_match ("/<H1>(.*?)<SPAN>/", $pars_fact, $wallz);
  10. $wallz = $wallz[1];
  11. echo "status good";
  12. $pars_fact = iconv( 'cp1251', 'utf-8', $v );
  13. $wall_post = curl( 'https://api.vk.com/method/wall.post?owner_id='.'&message='. urlencode( $wallz ) .'&access_token='. $access_token );//добавляем запись
  14. function curl( $url ) {
  15.         $ch = curl_init( $url );
  16.         curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
  17.         curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
  18.         curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
  19.        
  20.         $response = curl_exec( $ch );
  21.         curl_close( $ch );
  22.         return $response;
  23. }
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment