微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PhantomJs PHPJonnyW:无限页面加载

如何解决PhantomJs PHPJonnyW:无限页面加载

我刚才遇到一个问题。 当我使用PhantomJs PHP运行脚本时,包含脚本的页面卡住了。据我了解,它发生在phantomjs将请求发送到网站时(无论如何)。日志是空的,我不知道该怎么办。 我的OC:GNU / Linux(Ubuntu 20.04),apache2。

Code:

<?PHP

require_once('vendor/autoload.PHP');

use JonnyW\PhantomJs\Client;

$client = Client::getInstance();
$client->getEngine()->setPath('/var/www/colyt.com/futbal/phantom/bin/phantomjs');
$client->getEngine()->debug(true);

$request = $client->getMessageFactory()->createRequest('https://habr.com/ru/top/','GET');
$response = $client->getMessageFactory()->createResponse();

    // Send the request
$client->send($request,$response); //stucks here

if($response->getStatus() === 200) {

        // Dump the requested page content
    echo $response->getContent();
}

?>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。