private static function getContentsFromUrl($parameters)
{
if (!function_exists('curl_init')) {
return false;
}
$random = self::generateRandomString();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, Endpoints::INSTAGRAM_QUERY_URL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'q=' . $parameters);
$headers = array();
$headers[] = "Cookie: csrftoken={$random};";
$headers[] = "X-Csrftoken: {$random}";
$headers[] = "Referer: https://www.instagram.com/";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}