Skip to content

Instantly share code, notes, and snippets.

@dandyraka
Created June 20, 2019 12:53
Show Gist options
  • Save dandyraka/3802183f94bfaca03771cbe1ef70d795 to your computer and use it in GitHub Desktop.
Save dandyraka/3802183f94bfaca03771cbe1ef70d795 to your computer and use it in GitHub Desktop.
<?php
set_time_limit(0);
function curl($fullurl, $kuki)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
// curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, $fullurl);
curl_setopt($ch, CURLOPT_COOKIE, $kuki);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$returned = curl_exec($ch);
return ($returned);
}
$username = "xtrvts";
$json = curl('https://www.instagram.com/' . $username . '/', false);
preg_match('/window._sharedData\s=\s(.*?);</', $json, $data);
echo $data[1];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment