I use PHPCrawl for crawl websites but now I want to add a cookie to specific domain, because this domain has a authentication and I want to get information in authorized pages.
How can I add a cookie to specific domain?
Finally I find a way to add cookie to an specific domain:
I going to overload __construct in my own crawler class like this:
class MyCrawler extends PHPCrawler
{
function __construct() {
parent::__construct();
$s = new PHPCrawlerCookieDescriptor("localhost", "JSESSIONID", "DE7BCB89B0D5BB072357450F01415FAB");
$f[] = $s;
$this->PageRequest->addCookieDescriptors($f);
}
}
Now you should have a cookie with JSESSIONID
name and DE7BCB89B0D5BB072357450F01415FAB
for it's value.