postaddictme / instagram-php-scraper

Get account information, photos, videos, stories and comments.
https://packagist.org/packages/raiym/instagram-php-scraper
MIT License
3.1k stars 800 forks source link

script doesn't working error 500 #468

Closed emobin closed 5 years ago

emobin commented 5 years ago

all examples getting error 500 with below log:

[20-Mar-2019 12:19:43] PHP Fatal error: Uncaught InstagramScraper\Exception\InstagramAuthException: User credentials are wrong. in /home/drrma/vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php:1299 Stack trace:

0 /home/drrma/index.php(10): InstagramScraper\Instagram->login()

1 {main}

thrown in /home/drrma/vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php on line 1299

is there anyone help me, please!!!

filippodicostanzo commented 5 years ago

Try to use cli method for login. This with method you can enable the two factor authentication.

emobin commented 5 years ago

Try to use cli method for login. This with method you can enable the two factor authentication.

how can i do that? i am new to this script.

filippodicostanzo commented 5 years ago

After you download the package create a index.php file with this code:

require_once __DIR__ . '/vendor/autoload.php';

use InstagramScraper\Instagram;

Unirest\Request::verifyPeer(false);

/* THIS IS CAN INITIALIZE ONLY FOR THE FIRST TIME WITH php command in CMD for 2 FACT - AUTHENTICATOR */

 $instagram = Instagram::withCredentials('username', 'password', '/access');
 $instagram->login(false,true);

And after this you can run index.php with cmd on windows or terminal on osx

go to folder and write php index.php

and you follow the instruction for authentication on CDM or TERMINAL

emobin commented 5 years ago

After you download the package create a index.php file with this code:

require_once __DIR__ . '/vendor/autoload.php';

use InstagramScraper\Instagram;

Unirest\Request::verifyPeer(false);

/* THIS IS CAN INITIALIZE ONLY FOR THE FIRST TIME WITH php command in CMD for 2 FACT - AUTHENTICATOR */

 $instagram = Instagram::withCredentials('username', 'password', '/access');
 $instagram->login(false,true);

And after this you can run index.php with cmd on windows or terminal on osx

go to folder and write php index.php

and you follow the instruction for authentication on CDM or TERMINAL

it has been make access directory with a file in it, i was upload it in my host and use the below code but i have error 500 yet. what should i now? :((

require_once __DIR__ . '/vendor/autoload.php';
use InstagramScraper\Instagram;
 $instagram = Instagram::withCredentials('exampleuser', 'examplepass', '/access');
 $instagram->login(true,false);
$account = $instagram->getAccountById(3);
echo $account->getUsername();
filippodicostanzo commented 5 years ago

in your host can you run a php command? Otherwise you can run a command in local folder on your pc after you install php and you can run this command php index.php with cmd or terminal.

emobin commented 5 years ago

in your host can you run a php command? Otherwise you can run a command in local folder on your pc after you install php and you can run this command php index.php with cmd or terminal.

i was run this command in my windows and then upload access folder in my host directory

filippodicostanzo commented 5 years ago

Do you have teamviewer? if you want i can help you with TW. send me a credentials same ID and CODE via mail filippodicostanzo@gmail.com

emobin commented 5 years ago

i sent the tw details. thank you very very much bro