Advertisement
RieqyNS13

get toket

Jul 6th, 2014
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1. <?php
  2. function curl($url, $post=null){
  3.     $ch = curl_init();
  4.     curl_setopt($ch, CURLOPT_URL, $url);
  5.     if($post != null){
  6.         curl_setopt($ch, CURLOPT_POST, true);
  7.         curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  8.     }
  9.     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  10.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  11.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  12.     $exec = curl_exec($ch);
  13.     curl_close($ch);
  14.     return $exec;
  15. }
  16. $data = array("client_id"=>"*********", "client_secret"=>"*************", "grant_type"=>"authorization_code",
  17.     "redirect_uri"=>"http://instagram.com", "code"=>"****************");
  18. $curl = curl("https://api.instagram.com/oauth/access_token", $data);
  19. $json = json_decode($curl);
  20. if(isset($json->access_token))echo $json->access_token;
  21. else echo "error";
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement