Fatal error: Uncaught InstagramScraperExceptionInstagramAuthException: $twoStepVerificator must be an instance of TwoStepVerificationInterface. in /home/web/.../vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php:1751 Stack trace: #0 /home/web/.../vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php(1650): InstagramScraperInstagram->verifyTwoStep(Object(InstagramScraperHttpResponse), Array, NULL) #1 /home/web/.../tests/index.php(10): InstagramScraperInstagram->login() #2 {main} thrown in /home/web/.../vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php on line 1751
this in paginateAccountMediaByUsername.php
Probably, Instagram has marked your account as suspicious, or you are logging in from a non-standard location. There are three solutions to this problem:
InstagramScraper\Instagram::login(false, true). Second flag (true) enables two step verification. You need to enter the code to console after it is sent.$instagram->setUserAgent($userAgent);, enter the useragent you usually use to login in instagram. Also check example file https://github.com/postaddictme/instagram-php-scraper/blob/master/examples/setCustomCookies.php. For more complex work with this scraper you have to save coockies and set custom in each login.Ty rly
Maybe, there is an instruction or some kind of guide to all this?
Hi, try this example:
$instagram = new InstagramScraperInstagram(new GuzzleHttpClient());
$instagram = InstagramScraperInstagram::withCredentials(new GuzzleHttpClient(), 'username', 'password', new Psr16Adapter('Files'));
$instagram->setUserAgent('User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0');
$instagram->login(false, true);
$instagram->saveSession();
This works for me.
Hi, try this example:
$instagram = new InstagramScraperInstagram(new GuzzleHttpClient());
$instagram = InstagramScraperInstagram::withCredentials(new GuzzleHttpClient(), 'username', 'password', new Psr16Adapter('Files'));
$instagram->setUserAgent('User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0');
$instagram->login(false, true);
$instagram->saveSession();This works for me.
This works for me too
Hi, try this example:
$instagram = new InstagramScraperInstagram(new GuzzleHttpClient());
$instagram = InstagramScraperInstagram::withCredentials(new GuzzleHttpClient(), 'username', 'password', new Psr16Adapter('Files'));
$instagram->setUserAgent('User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0');
$instagram->login(false, true);
$instagram->saveSession();
This works for me.This works for me too
And for me too
Probably, Instagram has marked your account as suspicious, or you are logging in from a non-standard location. There are three solutions to this problem:
- You have to use
InstagramScraper\Instagram::login(false, true). Second flag (true) enables two step verification. You need to enter the code to console after it is sent.- Use function
$instagram->setUserAgent($userAgent);, enter the useragent you usually use to login in instagram. Also check example file https://github.com/postaddictme/instagram-php-scraper/blob/master/examples/setCustomCookies.php. For more complex work with this scraper you have to save coockies and set custom in each login.- Check this file, if you need security code by email auto comfirm. https://github.com/postaddictme/instagram-php-scraper/blob/master/examples/twoStepAutoVerification/loginWithEmailAutoCponfirm.php
2nd one worked the best for me. Using custom cookies is the best option because by using the first option, Instagram always sent mail for reminding new login which just occurs. It will be marked suspicious sooner or later if you do not use cookies.
Thanks
Most helpful comment
Hi, try this example:
$instagram = new InstagramScraperInstagram(new GuzzleHttpClient());
$instagram = InstagramScraperInstagram::withCredentials(new GuzzleHttpClient(), 'username', 'password', new Psr16Adapter('Files'));
$instagram->setUserAgent('User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0');
$instagram->login(false, true);
$instagram->saveSession();
This works for me.