Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function curl($url, $post=null){
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- if($post != null){
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
- }
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- $exec = curl_exec($ch);
- curl_close($ch);
- return $exec;
- }
- $data = array("client_id"=>"*********", "client_secret"=>"*************", "grant_type"=>"authorization_code",
- "redirect_uri"=>"http://instagram.com", "code"=>"****************");
- $curl = curl("https://api.instagram.com/oauth/access_token", $data);
- $json = json_decode($curl);
- if(isset($json->access_token))echo $json->access_token;
- else echo "error";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement