首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不能使用Phantomjs

不能使用Phantomjs
EN

Stack Overflow用户
提问于 2015-10-18 10:56:03
回答 1查看 1.3K关注 0票数 2

我试图使用PhantomJS,这是我的代码:

代码语言:javascript
复制
<?php
    require '../../../../vendor/autoload.php';

    use JonnyW\PhantomJs\Client;

    $client = Client::getInstance();

    $request  = $client->getMessageFactory()->createRequest();
    $response = $client->getMessageFactory()->createResponse();

    $request->setMethod('GET');
    $request->setUrl('http://google.com');

    $client->send($request, $response);

    var_dump($response);
?>

但这给了我一个错误:

代码语言:javascript
复制
Fatal error: Uncaught exception 'JonnyW\PhantomJs\Exception\ProcedureFailedException' with message 'Error when executing PhantomJs procedure "default" - File does not exist or is not executable: bin/phantomjs' in /var/www/html/vendor/jonnyw/php-phantomjs/src/JonnyW/PhantomJs/Procedure/Procedure.php:132 Stack trace: #0 /var/www/html/vendor/jonnyw/php-phantomjs/src/JonnyW/PhantomJs/Client.php(170): JonnyW\PhantomJs\Procedure\Procedure->run(Object(JonnyW\PhantomJs\Client), Object(JonnyW\PhantomJs\Message\Request), Object(JonnyW\PhantomJs\Message\Response)) #1 /var/www/html/vendor/jonnyw/php-phantomjs/examples/basic-request.php(15): JonnyW\PhantomJs\Client->send(Object(JonnyW\PhantomJs\Message\Request), Object(JonnyW\PhantomJs\Message\Response)) #2 {main} thrown in /var/www/html/vendor/jonnyw/php-phantomjs/src/JonnyW/PhantomJs/Procedure/Procedure.php on line 132

所以它在这条线上崩溃了:

代码语言:javascript
复制
 $client->send($request, $response);

我尝试了chmod 777所有的\供应商目录和儿童,但什么都不改变,你有主意吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-10-18 16:47:43

好的,我只需将链接添加到bin目录中,该目录位于我的项目根目录中。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33197118

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档