Сообщество IT-специалистов
Ответы на любые вопросы об IT
Профессиональное развитие в IT
Удаленная работа для IT-специалистов
$cookie = new Cookie('flavor', 'chocolate', strtotime('+1 day')); $cookieJar = new CookieJar(); $cookieJar->set($cookie); // create a client and set the cookies $client = new Client(array(), null, $cookieJar);
Symfony\Component\BrowserKit\CookieJar Object ( [cookieJar:protected] => Array ( [.yahoo.com] => Array ( [/] => Array ( [B] => Symfony\Component\BrowserKit\Cookie Object ( [name:protected] => B [value:protected] => bojr0r1d9alej&b=3&s=hc [expires:protected] => 1551790675 [path:protected] => / [domain:protected] => .yahoo.com [secure:protected] => [httponly:protected] => [rawValue:protected] => bojr0r1d9alej&b=3&s=hc ) ) ) ) )
$cookieJar = new FileCookieJar(__DIR__.'/cookie.txt',true); $goutteClient = new Client(); $guzzleClient = new GuzzleClient(array( 'timeout' => 60, 'cookies' =>$cookieJar )); $goutteClient->setClient($guzzleClient); $crawler = $goutteClient->request('GET', 'https://www.yahoo.com/news/weather/russia/moscow/moscow-2122265');