Answer the question
In order to leave comments, you need to log in
How to properly use cookies in phantomJS?
Entering the site through a phantom, he writes to me that cookies need to be enabled, I enabled them as written in the instructions
require '../vendor/autoload.php';
use JonnyW\PhantomJs\Client;
$client = Client::getInstance();
$client->getEngine()->setPath('../bin/phantomjs');
$request=$client->getMessageFactory()->createRequest();
$response=$client->getMessageFactory()->createResponse();
$client->getEngine()->addOption('--cookies-file=../cookie.txt');
$request->setMethod('GET');
$request->setUrl($url);
$content=$client->send($request,$response);
echo_var_dump($content);
[General]
cookies="@Variant(\0\0\0\x7f\0\0\0\x16QList\0\0\0\0\x1\0\0\0\x1\0\0\0\ x63\x63sm-sid=378-9176816-8921664; expires=Tue, 18-Jun-2019 16:14:29 GMT; domain=www...........; path=/)"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question