Answer the question
In order to leave comments, you need to log in
Authorization in instagram through curl, what's next?
I'm trying to do so.
<?php
ini_set('display_errors', TRUE); error_reporting(E_ALL);
$login_url = 'https://www.instagram.com/';
$login_url_post = 'https://www.instagram.com/accounts/login/ajax/';
$agent = "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0";
$post_data = 'username=user&password=pass';
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_URL, $login_url );
//curl_setopt($ch, CURLOPT_POST, 1 );
//curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
//curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, '/home/deterrent/www/site.ru/curl/cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, '/home/deterrent/www/site.ru/curl/cookie.txt');
$postResult = curl_exec($ch);
var_dump ($postResult);
$ch2 = curl_init();
curl_setopt($ch2, CURLOPT_USERAGENT, $agent);
curl_setopt($ch2, CURLOPT_URL, $login_url_post );
curl_setopt($ch2, CURLOPT_POST, 1 );
curl_setopt($ch2, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch2, CURLOPT_FOLLOWLOCATION, 1);
//curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch2, CURLOPT_COOKIEJAR, '/home/deterrent/www/site.ru/curl/cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, '/home/deterrent/www/site.ru/curl/cookie.txt');
$postResult2 = curl_exec($ch2);
var_dump ($postResult2);
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question