Php 解决instagram私有api中所需的难题
当我登录到我的帐户时,我试图解决Instagram所需的挑战,我使用的是mgp25 Instagram API库(V4.1.0稳定版) 为了解决这个问题,我能够嗅探到必要的请求,但是当我将它们添加到库中时,我遇到了问题 我写这个函数是为了向我的电子邮件或电话请求代码Php 解决instagram私有api中所需的难题,php,instagramapi-mgp25,Php,Instagramapi Mgp25,当我登录到我的帐户时,我试图解决Instagram所需的挑战,我使用的是mgp25 Instagram API库(V4.1.0稳定版) 为了解决这个问题,我能够嗅探到必要的请求,但是当我将它们添加到库中时,我遇到了问题 我写这个函数是为了向我的电子邮件或电话请求代码 // Challenge url on this format /challenge/1463452997/1zS1L8kl62/ public function sendChallenge($challenge_url) {
// Challenge url on this format /challenge/1463452997/1zS1L8kl62/
public function sendChallenge($challenge_url)
{
return $this->request($challenge_url)
->addParam('choice', 1)
->addPost('device_id', $this->device_id)
->addPost('guid', $this->uuid)
->addPost('_csrftoken', $this->client->getToken())
->getResponse(new Response\UserInfoResponse());
}
我的问题是,每当我请求这个函数时,不管我把它放在哪里,我总是得到它
“用户未登录。请调用login(),然后重试。”
因此,在登录失败(检索质询url所必需的)后,如何使用此函数而不让用户未登录异常解决方案是设置setNeedsAuth(false) 这对我很有用: 步骤:
在向instagram发送请求之前,您必须选择要发送的用户 您可以将下面的行添加到代码中并选择用户
// Challenge url on this format /challenge/1463452997/1zS1L8kl62/
public function sendChallenge($username, $password, $challenge_url)
{
//this line require for select user that your login in before
$this -> changeUser ($username, $password);
return $this->request($challenge_url)
->addParam('choice', 1)
->addPost('device_id', $this->device_id)
->addPost('guid', $this->uuid)
->addPost('_csrftoken', $this->client->getToken())
->getResponse(new Response\UserInfoResponse());
}
根据您的场景,首先您必须为instagram调用登录api,然后在成功登录后,您必须调用challenge api,但这没有帮助吗?作者不想在这里为同样的问题写一个解决方案,这太神奇了,但是我怎么能得到挑战url?!对于需要进行挑战的登录用户@你解决问题了吗?我需要把这个函数放在哪里?我只是想知道你们是否已经解决了这个问题?我假设该函数应该放在Instagram.php中。我说得对吗?我已经成功地通过了$challenge\u url,但是我不知道如何使用上面的代码继续使用$challenge\u url。如果有人能帮忙,我将不胜感激!此函数是否放在Instagram.php中?如果是这样的话,这是否意味着我们需要进行回购以进行更改,因为更改供应商文件夹中的文件不是最佳做法?我是在拉威尔项目的背景下问的。谢谢
// Challenge url on this format /challenge/1463452997/1zS1L8kl62/
public function sendChallenge($username, $password, $challenge_url)
{
//this line require for select user that your login in before
$this -> changeUser ($username, $password);
return $this->request($challenge_url)
->addParam('choice', 1)
->addPost('device_id', $this->device_id)
->addPost('guid', $this->uuid)
->addPost('_csrftoken', $this->client->getToken())
->getResponse(new Response\UserInfoResponse());
}