-2

我的网站上有一个名为Instazood的工作脚本,它运行良好。突然,几天前,我根本无法使用我的脚本。一切,它给出了“需要挑战”的错误。我在我的 Instagram 上验证是我,但是在运行脚本时我得到了同样的错误。

我删除了会话文件夹,但没有运气。

我在这里读到问题是由于不同的IP。但是我所有的设备都使用同一个互联网,而且我根本没有代理。

我有以下错误。

Fatal error: Uncaught InstagramAPI\Exception\ChallengeRequiredException: InstagramAPI\Response\LoginResponse: Challenge required.uring import data.
4

2 回答 2

0

您需要使用库提供的两种因素身份验证方法。这是一个例子:

<?php

set_time_limit(0);
date_default_timezone_set('UTC');

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

/////// CONFIG ///////
$username = '';
$password = '';
$debug = true;
$truncatedDebug = false;
//////////////////////

$ig = new \InstagramAPI\Instagram($debug, $truncatedDebug);

try {
    $loginResponse = $ig->login($username, $password);

    if ($loginResponse !== null && $loginResponse->isTwoFactorRequired()) {
        $twoFactorIdentifier = $loginResponse->getTwoFactorInfo()->getTwoFactorIdentifier();

        // The "STDIN" lets you paste the code via terminal for testing.
        // You should replace this line with the logic you want.
        // The verification code will be sent by Instagram via SMS.
        $verificationCode = trim(fgets(STDIN));
        $ig->finishTwoFactorLogin($username, $password, $twoFactorIdentifier, $verificationCode);
    }
} catch (\Exception $e) {
    echo 'Something went wrong: '.$e->getMessage()."\n";
}

在相关说明中,我无法从 GitHub 下载该软件包,因为它最近被删除了。你认为你可以只上传mgp25/instagram-php包以便我下载吗?我将不胜感激!!

于 2020-02-26T11:32:00.097 回答
0

composer 需要 adrifkat/instagram-api 来下载包@tblanks1980

于 2020-04-13T19:46:18.870 回答