PhantomJS的文档确实展示了如何使用代理。但是,当使用PHP PhantomJS的库时,如何在 PHP 中使用?
就此而言,如何使用任何 PhantomJS 插件?
我目前正在使用 CURL 执行此操作以使用代理:
curl_setopt($curl, CURLOPT_PROXY, "http://$proxy:$port");
curl_setopt($curl, CURLOPT_PROXYUSERPWD, "$username:$password");
我想用 PhantomJS 做同样的事情。我已经正确安装和配置了它,这个例子有效(PHP PantomJS 自己的例子)。
use JonnyW\PhantomJs\Client;
$client = Client::getInstance();
$request = $client->getMessageFactory()->createRequest();
$response = $client->getMessageFactory()->createResponse();
$request->setMethod('GET');
$request->setUrl('http://jonnyw.me');
$client->send($request, $response);
print_r($response);
代理信息在哪里?
谢谢。我对 PhantomJS 很陌生。