Guest User

Untitled

a guest
Jul 22nd, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1. <?php
  2. // client_id, access_token, user_id указываю валидные
  3. // По ссылке щелкаю, получаю токен, потом его копирую в курл.  
  4. echo '<a href="https://oauth.vk.com/authorize?client_id=client_id&scope=friends&display=page&response_type=token&redirect_uri=https://oauth.vk.com/blank.html">https://oauth.vk.com/blank.html</a>';
  5.     $ch = curl_init( 'https://api.vk.com/method/friends.add?access_token=access_token');
  6.         curl_setopt ( $ch, CURLOPT_HEADER, false );
  7.         curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
  8.         curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, false );
  9.         curl_setopt ( $ch, CURLOPT_POST, true );
  10.         curl_setopt ( $ch, CURLOPT_POSTFIELDS, 'user_id=user_id' );
  11.         $data = curl_exec($ch);
  12.         curl_close($ch);
  13.         print_r ($data);
  14.    
  15.    
  16.    
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment