如何搞呢?我发下代码 require 'vendor/autoload.php'; use JonnyW\PhantomJs\Client;
$client = Client::getInstance();
$client->getEngine()->setPath('/www/wwwroot/phantomjs-2.1.1-linux-x86_64/bin/phantomjs'); //设置 phantomjs 位置 $client->getEngine()->addOption('--load-images=false'); $client->getEngine()->addOption('--ignore-ssl-errors=true'); $client->getEngine()->addOption('--local-to-remote-url-access=true'); $client->isLazy();// 让客户端等待所有资源加载完毕
$url = $_REQUEST['url']; $url = 'https://m.toutiaoimg.cn/group/6695506106313080836/?app=news_article×tamp=1558936734&share_ht_uid=58738473383&did=55927714761&utm_medium=toutiao_android&tt_from=copy_link'; $request = $client->getMessageFactory()->createRequest($url, 'GET');
$timeout = 10000; //设置超时 $request->setTimeout($timeout);
$request->addSetting('userAgent', 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3704.400 QQBrowser/10.4.3587.400');//设置 ua
$response = $client->getMessageFactory()->createResponse(); $client->send($request, $response);
$allHtml = $response->getContent(); print_r($allHtml);
打开显示: 您访问的页面不存在
它是做了什么处理吗?应该如何绕过呢?