Answer the question
In order to leave comments, you need to log in
How to run puppeteer through proxy?
I'm trying to run puppeteer through a proxy
require('/var/www/html/vendor/autoload.php');
use Nesk\Puphpeteer\Puppeteer;
use Nesk\Rialto\Data\JsFunction;
use Nesk\Rialto\Exceptions\Node;
$proxy='.....................';
$puppeteer=new Puppeteer;
$options=array(
'headless'=>false,
'defaultViewport'=>array('width'=>1440,'height'=>900,'isMobile'=>false),
'ignoreHTTPSErrors'=>true,
'ignoreDefaultArgs'=>true,
'args'=>array('--incognito',
'--proxy-server='.$proxy.'',
'--0',
'--window-size=1440,900',
'--no-sandbox',
'--disable-setuid-sandbox',
'--ignore-certifcate-errors',
'--ignore-certifcate-errors-spki-list',
'--shm-size=2gb')
);
$options['browserWSEndpoint']='ws://localhost:3000/?ignoreDefaultArgs=true&headless=false&'.implode('&',$options['args']);
$browser=$puppeteer->connect($options);
$page=$browser->createIncognitoBrowserContext()->newPage();
$page->setUserAgent($user_agent);
$page->goto('https://.......');
$content=$page->content();
echo htmlentities($content);
$browser->close();
Fatal error: Uncaught Nesk\Rialto\Exceptions\Node\FatalException: net::ERR_TUNNEL_CONNECTION_FAILED at https://.....
'--proxy-server='.$proxy.'',
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