Getting error ( Response code is 200: OK.Something went wrong. ) while login by loginWithSessionId.
MohsinEusopht opened this issue · 6 comments
MohsinEusopht commented
I am getting the error ( Response code is 200: OK.Something went wrong. ) while login by loginWithSessionId.
MY CODE
public function loginWithSessionId($sessionId)
{
// $session = ['sessionid' => $sessionId, 'csrftoken' => md5( rand( 1, 5000 ) )];
$split = preg_split('/%/', $sessionId, -1, PREG_SPLIT_OFFSET_CAPTURE);
$our_id= $split[0][0];
$session = ['sessionid' => $sessionId, 'csrftoken' => md5(rand(1, 5000)), 'ds_user_id' => $our_id];
if (!$this->isLoggedIn($session)) {
throw new InstagramAuthException('Login with session went wrong. Please report issue.');
} else {
$this->userSession = $session;
}
return $this->generateHeaders($this->userSession);
}
public function isLoggedIn($session = null)
{
if ($session === null) {
$session = static::$instanceCache->get($this->getCacheKey());
}
if (!isset($session['sessionid'])) {
return false;
}
$sessionId = $session['sessionid'];
$csrfToken = $session['csrftoken'];
$ds_user_id = $session['ds_user_id'];
$headers = [
'cookie' => "ig_cb=1; csrftoken=$csrfToken; sessionid=$sessionId; ds_user_id=$ds_user_id;",
'referer' => Endpoints::BASE_URL . '/',
'x-csrftoken' => $csrfToken,
'X-CSRFToken' => $csrfToken,
'user-agent' => $this->getUserAgent(),
];
$response = Request::get(Endpoints::BASE_URL, $headers);
echo "<pre>";
var_dump($response);
if ($response->code !== static::HTTP_OK) {
return false;
}
$cookies = $this->parseCookies($response->headers);
// if (!isset($cookies['ds_user_id'])) {
// return false;
// }
return true;
}
M4S3S7 commented
same problem :(
arfiantorodev commented
Same :(
alisamie97 commented
I am getting this error from this piece of code
require_once "../vendor/autoload.php";
use Phpfastcache\Helper\Psr16Adapter;
$instagram = new \InstagramScraper\Instagram(new \GuzzleHttp\Client());
try{
$nonPrivateAccountMedias = $instagram->getMedias($page);
echo $nonPrivateAccountMedias[0]->getLink();
}catch(\Exception $e){
echo json_encode([
'success' => false,
'code' => $e->getCode(),
'message' => $e->getMessage()
]);
die;
}
stjnvc commented
Any updates on this issue?? Still getting it.
trialforce commented
I got same with the basic account request.
thanhtoan1196 commented
same here!!