Mac
流程: php脚本 => chromedriver => chrome
翻墙工具
chrome浏览器
chromedriver
chrome驱动程序
php-webdriver
php与chromedriver通信的类库
1:安装php-webdriver
创建demo目录,在目录中执行 composer require facebook/webdriver
2:下载chromedriver,双击运行
3:在demo目录,创建demo.php文件
get('http://www.baidu.com'); $cookies = $driver->manage()->getCookies(); print_r($cookies); echo "The title is '" . $driver->getTitle() . "'\n"; echo "The current URI is '" . $driver->getCurrentURL() . "'\n"; //关闭浏览器 $driver->quit();
4:运行demo.phpphp demo.php
以上是PHP控制浏览器动作的详细内容。更多信息请关注PHP中文网其他相关文章!