spatie / crawler

An easy to use, powerful crawler implemented in PHP. Can execute Javascript.

Home Page:https://freek.dev/308-building-a-crawler-in-php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

302 Redirects?

amousavii opened this issue · comments

How to continue to a page that gets status code 302 and redirected?

When instantiating the crawler you can pass guzzlhttp client options. You would need to pass the option to follow redirects.

Crawler::create([RequestOptions::ALLOW_REDIRECTS => true]);

or if you want to track them and have the redirects in a response header:

Crawler::create([
RequestOptions::ALLOW_REDIRECTS => [
                'track_redirects' => true,
            ],
]);

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.