Closed devguar closed 5 years ago
Same issue from today.
Undefined index: Set-Cookie', '/web/htdocs/www.amalficoastapps.it/home/costaeventi/app/Helpers/instagram/vendor/raiym/instagram-php-scraper/src/InstagramScraper/Instagram.php'
+1
Set-Cookie is missing in the headers while trying to GET https://instagram.com
This solution worked for me - added lines below before first line
$cookies = static::parseCookies($response->headers['Set-Cookie']);
:
if (!isset($response->headers['Set-Cookie'])) { $response->headers['Set-Cookie'] = array( 0 => 'sessionid=""; Domain=instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/', 1 => 'sessionid=""; Domain=.instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/', 2 => 'sessionid=""; Domain=i.instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/', 3 => 'sessionid=""; Domain=.i.instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/', 4 => 'sessionid=""; Domain=www.instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/', 5 => 'sessionid=""; Domain=.www.instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/', 6 => 'sessionid=""; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/', 7 => 'rur=FRC; Path=/', 8 => 'csrftoken=S2HakrkyU9evCAdrcmTyVuxzwxFYizxk; expires=Tue, 21-May-2019 18:47:36 GMT; Max-Age=31449600; Path=/; Secure', 9 => 'mid=WwRlyAAEAAHlTjH28IARKDQN7Gqk; expires=Mon, 17-May-2038 18:47:36 GMT; Max-Age=630720000; Path=/' ); }
@NielsWeeber yes, this worked here too! Thanks, Im using this by now...
But i think this is not a definitive solution because maybe the csrftoken can change. Or not?
I found a easy solution.... see PR #382
Hello; Does anyone have some news about this issue? Even in the latest tag version it still doesn't work.
Thank you;
Awaiting the fixes to be merged (see pull requests). Not alot that can be done until that is done apart from manually patching your code.
why i have two mid values in session ? one them is have 1970'date other one is normal ? can idelete of that dublicated Set-Cookie Values ? or is it a normal situation ?
["headers"]=> array(12) { [0]=> string(15) "HTTP/1.1 200 OK" ["Content-Type"]=> string(16) "application/json" ["Vary"]=> string(23) "Cookie, Accept-Language" ["Cache-Control"]=> string(44) "private, no-cache, no-store, must-revalidate" ["Pragma"]=> string(8) "no-cache" ["Expires"]=> string(29) "Sat, 01 Jan 2000 00:00:00 GMT" ["Content-Language"]=> string(2) "en" ["Date"]=> string(29) "Fri, 15 Jun 2018 17:41:41 GMT" ["Strict-Transport-Security"]=> string(13) "max-age=86400" ["Set-Cookie"]=> array(11) { [0]=> string(90) "target=""; Domain=.instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/" [1]=> string(138) "csrftoken=HZeOeXyyrXu5vXXRXtHlipXoocXD5X3v; Domain=.instagram.com; expires=Fri, 14-Jun-2019 17:41:41 GMT; Max-Age=31449600; Path=/; Secure" [2]=> string(96) "shbid=1526; Domain=.instagram.com; expires=Fri, 22-Jun-2018 17:41:41 GMT; Max-Age=604800; Path=/" [3]=> string(110) "shbts=1529284501.1982205; Domain=.instagram.com; expires=Fri, 22-Jun-2018 17:41:41 GMT; Max-Age=604800; Path=/" [4]=> string(38) "rur=ATN; Domain=.instagram.com; Path=/" [5]=> string(121) "mid=XyP6VXXEAAGmlTCWh0Xy4idlArXI; Domain=.instagram.com; expires=Thu, 10-Jun-2038 17:41:41 GMT; Max-Age=630720000; Path=/" [6]=> string(108) "ds_user_id=4352727069; Domain=.instagram.com; expires=Thu, 13-Sep-2018 17:41:41 GMT; Max-Age=7776000; Path=/" [7]=> string(600) "sessionid=IGSC936549ff6ffe4e6XXXXc66cc5e81fbe19aaXXXXXc940af01dbe1730b0d19%3AWAidQby0qHzocnBkWZNDXa34cH8MNBEA%3A%7B%22_auth_user_id%22%3A4352727069%2C%22_auth_user_backend%22%3A%22accounts.backends.CaseInsensitiveModelBackend%22%2C%22_auth_user_hash%22%3A%22%22%2C%22_platform%22%3A4%2C%22_token_ver%22%3A2%2C%22_token%22%3A%224352727069%3AhTupTofXXXXXX9hqGBF1b%3A74c0d19805037bfca445dbf79fa73cce10491c8aaf24fc02cb169b978750f269%22%2C%22last_refreshed%22%3A1529084501.198900938%7D; Domain=.instagram.com; expires=Thu, 13-Sep-2018 17:41:41 GMT; HttpOnly; Max-Age=7776000; Path=/; Secure" [8]=> string(70) "csrftoken=""; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/" [9]=> string(64) "mid=""; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/" [10]=> string(36) "mcd=3; Domain=.instagram.com; Path=/" } ["Connection"]=> string(10) "keep-alive" ["Content-Length"]=> string(3) "121" }
Look on PR #420
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi, im having some errors after upgrading my machine to ubuntu 18.04. It was working until I did this update, but I do not know if it has a connection or if it was just a coincidence.
When try to login on Instagram:
Its throwing this exception: Undefined index: Set-Cookie
In the return header there is no 'Set-Cookie' position. Is anyone else having this problem? Can it be something from my environment?
Environment: -Ubuntu 18.04 -PHP 7.2
I could simply ignore this error (changind the error_reporting property) and let it continue, but then it can not log in and all requests after ends in 403 and with the message: "This page could not be loaded. If you have cookies disabled in your browser, or you are browsing in Private Mode, please try enabling cookies or turning off Private Mode, and then retrying your action.".
Need any other information? Thanks!