shinoshi/nightmare-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

shinoshi/nightmare-php

最新稳定版本:0.9.5

Composer 安装命令:

composer require shinoshi/nightmare-php

包简介

PHP wrapper for nightmareJS

README 文档

README

PHP wrapper for NightmareJS

Usage

Raw option (recommended):

use dioro\nightmarePHP\nightmarePHP;

$nightmare = new nightmarePHP();

$nightmare->rawInput("
const Nightmare = require(\"nightmare\");
const nightmare = Nightmare({ show: false });

nightmare
    .goto('https://www.reddit.com/r/news/')
    .wait('#siteTable > div:first-child .title > a')
    .evaluate(() => document.querySelector(\"#siteTable > div:first-child .title > a\").textContent)
.end()
    .then(console.log)
    .catch((error) => {console.error('Search failed:', error);});")
    ->run();

var_dump($nightmare->getResult()); #returns latest title of the /r/news subreddit

Predefined method option:

use dioro\nightmarePHP\nightmarePHP;

$nightmare = new nightmarePHP();

$nightmare->config("show: false");

$nightmare
->_goto('https://www.reddit.com/r/news/')
->wait('#siteTable > div:first-child .title > a')
->evaluate("() => document.querySelector(\"#siteTable > div:first-child .title > a\").textContent")
->end()
->then("console.log")
->_catch("(error) => {console.error('Search failed:', error);}")
->run();

var_dump($nightmare->getResult()); #returns latest title of the /r/news subreddit

Predefined method option may not include all up to date options that NightmareJS offers to which the documentation can be found their official github repo

统计信息

  • 总下载量: 8.43k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-25