Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $profile = $_GET['profile'];
- $default_redirect_link = "http://instagram.com";
- $ch = curl_init("https://www.instagram.com/".$profile."/");
- curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
- curl_setopt ($ch, CURLOPT_TIMEOUT, 10);
- curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 10);
- curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt ($ch, CURLOPT_HTTPHEADER, array(
- 'user-agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36',
- ));
- $data = curl_exec($ch);
- curl_close ($ch);
- $data = explode(";</script>", explode("window._sharedData = ", $data)[1])[0];
- if($data[0] == "{"){
- $json_data = json_decode($data);
- $external_url = $json_data->entry_data->ProfilePage[0]->graphql->user->external_url;
- if($external_url != null){
- header("Location: ".$external_url);
- }else{
- header("Location: ".$default_redirect_link);
- }
- }else{
- header("Location: ".$default_redirect_link);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement