Login Into Instagram using Cookie curl PHP


#1

I am trying to login into Instagram using cookies. I am using CURL its give me in response a blank page

$cookie = "mid=-MIDVALUE-;csrftoken=-TOKEN-;sessionid=-SESSIONID-3%3AvOZRX4fPL9K5L66ztOV9D28F8j2A3CF9%3A%7B%22_auth_user_id%22%3A5607163585%2C%22_auth_user_backend%22%3A%22accounts.backends.CaseInsensitiveModelBackend%22%2C%22_auth_user_hash%22%3A%22%22%2C%22_platform%22%3A4%2C%22_token_ver%22%3A2%2C%22_token%22%3A%225607163585%3AgdHBjbbOmDw5KHQyXJ7ipnXifcf6LiDP%3Abb2dd9683364a2a3d8fd01a240effb73b3ed19ab12f3f33e9b864e5ee1e6ec38%22%2C%22last_refreshed%22%3A1518249956.7502748966%7D";
$url = "https://www.instagram.com/accounts/login/";
$ch = @curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
$head[] = "Connection: keep-alive";
$head[] = "Keep-Alive: 300";
$head[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
$head[] = "Accept-Language: en-us,en;q=0.5";
curl_setopt($ch, CURLOPT_USERAGENT, 'Opera/9.80 (J2ME/MIDP; Opera Mini/9.80 (S60; SymbOS; Opera Mobi/23.348; U; en) Presto/2.5.25 Version/10.54');
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_HTTPHEADER, $head);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);

$page = curl_exec($ch);
curl_close($ch);

I was getting this cookies from manually copy from browser just need to use cookies to login i know this code is not much batter that is because i don't know much about how Instagram work..


closed #2

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.