###前提・実現したいこと
PHPのPhantomJSライブラリ「PHP PhantomJS」(公式サイト)を利用してPHPからPhantomJSを用いてサイト画像などを取得したいです。
###発生している問題・エラーメッセージ
公式ドキュメントにあるように、Composerを用いてインストールし、試しにサンプルスクリプトを実行しましたが、下記エラーが発生します。
PHP Fatal error: Can't inherit abstract function JonnyW\PhantomJs\Procedure\OutputInterface::import() (previously declared abstract in JonnyW\PhantomJs\Http\ResponseInterface) in /home/scraper/public_html/php_phantomjs/vendor/jonnyw/php-phantomjs/src/JonnyW/PhantomJs/Http/Response.php on line 20
###ソースコード
/home/test/public_html/test/composer.json
{ "name": "php_phantomjs", "require": { "jonnyw/php-phantomjs" : "4.*" }, "scripts" : { "post-install-cmd" : [ "PhantomInstaller\\Installer::installPhantomJS" ], "post-update-cmd" : [ "PhantomInstaller\\Installer::installPhantomJS" ] } }
/home/test/public_html/test/test.php(テストコード)
<?php require 'vendor/autoload.php'; use JonnyW\PhantomJs\Client ; $client = Client :: getInstance (); $client->getEngine()->setPath('/usr/bin/phantomjs'); $request = $client -> getMessageFactory () -> createRequest (); $response = $client -> getMessageFactory () -> createResponse (); $request -> setMethod ( 'GET' ); $request -> setUrl ( 'http://jonnyw.me' ); $client -> send ( $request , $response ); if ( $response -> getStatus () === 200 ) { echo $response -> getContent (); } ?>
###補足情報(言語/FW/ツール等のバージョンなど)
サーバはDTIのServersMan@VPSのスタンダードでCentOS 6 (64bit)
サーバには、PhantomJSとComposerはインストール済みです。
インストール先は「/usr/bin/phantomjs」と「/usr/local/bin/composer」です。
PHPのバージョンは5.3.3です。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/04/01 04:49