htmlbuilder php phantomjs
*
参考文章:php-phantomjs
get-started
composer.json
{"scripts": {"post-install-cmd": ["PhantomInstaller\\Installer::installPhantomJS"],"post-update-cmd": ["PhantomInstaller\\Installer::installPhantomJS"]},"config": {"bin-dir": "bin"},"require": {"jonnyw/php-phantomjs": "4.*"} }
*
cmd
D:\software\WebServer\apache\Apache24\htdocs\builder_front>composer require "jonnyw/php-phantomjs:4.*" ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev)
*
结果
*
产生的文件目录verdor和bin
*
*
<?phprequire "vendor\autoload.php";use JonnyW\PhantomJs\Client;// require_once 'vendor_phantomjs/jonnyw/php-phantomjs/src/JonnyW/PhantomJs/Client.php';$client = Client::getInstance();$client->getEngine()->setPath('D:/software/WebServer/apache/Apache24/htdocs/builder_front/dist/bin/phantomjs.exe');/** * @see JonnyW\PhantomJs\Http\PdfRequest**/$request = $client->getMessageFactory()->createPdfRequest('http://www.baidu.com', 'GET');$request->setOutputFile('E:/document.pdf');$request->setFormat('A4');$request->setOrientation('landscape');$request->setMargin('1cm');/** * @see JonnyW\PhantomJs\Http\Response **/$response = $client->getMessageFactory()->createResponse();// Send the request$client->send($request, $response);
*
成功产生pdf
遇到的问题
1,PHP Fatal error: Class 'JonnyW\PhantomJs\Client' not found in ...
在代码里require了autoload.php就可以了
2,phantomjs一直找不到,是因为下面这句忘记写exe了,应该是完整路径
$client->getEngine()->setPath('D:/software/WebServer/apache/Apache24/htdocs/builder_front/dist/bin/phantomjs.exe');
*
转载于:https://www.cnblogs.com/qingmaple/p/6072525.html
htmlbuilder php phantomjs相关推荐
- Python:Selenium和PhantomJS
Selenium Selenium是一个Web的自动化测试工具,最初是为网站自动化测试而开发的,类型像我们玩游戏用的按键精灵,可以按指定的命令自动操作,不同是Selenium 可以直接运行在浏览器上, ...
- java phantomjs 2.1.1_Java之网络爬虫WebCollector2.1.2+selenium2.44+phantomjs2.1.1
/*** Project Name:padwebcollector * File Name:DiscussService.java * Package Name:com.pad.service * D ...
- [Python爬虫] 之二十二:Selenium +phantomjs 利用 pyquery抓取界面网站数据
一.介绍 本例子用Selenium +phantomjs爬取界面(https://a.jiemian.com/index.php?m=search&a=index&type=news& ...
- 基于Python, Selenium, Phantomjs无头浏览器访问页面
引言: 在自动化测试以及爬虫领域,无头浏览器的应用场景非常广泛,本文将梳理其中的若干概念和思路,并基于代码示例其中的若干使用技巧. 1. 无头浏览器 通常大家在在打开网页的工具就是浏览器,通过界面上输 ...
- Java实现网页截屏功能(基于phantomJs)
公司最近有个需求:把用户第一次的测量身体信息和最近一次测量信息进行对比,并且需要把对比的数据截成图片可以发给用户(需要在不打开网页的情况下实时对网页进行截图然后保存到服务器上,返回图片地址),通过网上 ...
- java phantomjd linux_linux安装phantomjs
1. 首先要下载浏览器驱动: 常用的是chromedriver 和phantomjs chromedirver下载地址: https://npm.taobao.org/mirrors/chromedr ...
- python selenium p_Python爬虫(二十一)_Selenium与PhantomJS
本章将介绍使用Selenium和PhantomJS两种工具用来加载动态数据,更多内容请参考:Python学习指南 Selenium Selenium是一个Web的自动化测试工具,最初是为网站自动化测试 ...
- Remove PyPhantomJS. · f6c29b1 · ariya/phantomjs
Remove PyPhantomJS. · f6c29b1 · ariya/phantomjs Remove PyPhantomJS. Since there is no future maintai ...
- NodeJS + PhantomJS 前端自动化资源监控
前言:最近做前端资源监控,看了很多例子,没有达到想要的效果.首先的槽点是PhantomJS的官方文档,真鸡肋,其次是网上的例子,多数是介绍PhantomJS的用法,而并没有介绍怎么完整的去实现,跟官方 ...
最新文章
- AI芯片体系结构目标图形处理
- pytorch dropout_手把手带你使用字符级RNN生成名字 | PyTorch
- python自动化办公入门书籍推荐-盘点使用Python进行自动化办公所需要的知识点
- 为什么你应该停止阅读新闻?
- 50道mysql笔试题目及答案_50道SQL练习题及答案与详细分析!!!
- 2015年第六届蓝桥杯C/C++ A组国赛 —— 第一题:方格填数
- mysql 无论输入什么都是现实 not found_NotAPanda
- python中的自测语句是什么?
- 权限管理su、sudo、限制root远程登录
- 先根序列创建二叉树c语言,用C语言创建二叉树并先序遍历.doc
- 如何最大程度地提高cin和cout的效率
- 《算法导论》.pdf
- python控制51单片机的红绿灯_基于51单片机的交通灯控制设计
- python和r语言生物信息学_R语言和Python哪个适合生物信息学?
- php 微信 40125,微信公众号问题:quot;errcodequot;:40125,quot;errmsgquot;
- 端游网易我的世界服务器未响应,我的世界 PC 端游戏启动异常处理指引(2018.09.21)...
- 为什么要在信号线上串联一些小电阻
- routerOS做wan口的交换机扩展和带宽叠加
- BIM家装族库丨艺术家具族
- MATLAB中未定义函数或变量”的问题