Reputation: 301
So here is my problem: I want to login to a website using curl, and I send the login credentials with POST. However, after the successful login, I get redirected to a url, where my sessionid is passed with GET (and not in the cookies, so no way to get them from there). I would need that sessionid to access to the protected pages. So, how do I get it?
Any help is really appreciated.
Upvotes: 0
Views: 2885
Reputation: 19985
$sessionId = parse_url( curl_getinfo($ch, CURLINFO_EFFECTIVE_URL) )['sessionId'];
Change 'sessionId' to the token name being used.
Upvotes: 0
Reputation: 31813
$url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
and then follow with parse_url() and then parse_str()
Upvotes: 1