1、 Download and install phantomjs according to your own platform https://phantomjs.org/download.html
2、 Call a JS file to access the URL connection that needs to be collected
// Example using HTTP POST operation
"use strict";
var page = require('webpage').create(),
system = require('system'),
server = system.args[1],
settings = {
encoding: "utf8",
headers: {
"Content-Type": "text/html",
"Cookie": "cookie",
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1"
}
};
page.open(server, settings, function (status) {
var content = page.evaluate(function() {
return document.getElementById('uiContent').innerHTML;
});
console.log(content);
phantom.exit();
});
3,
<?php
$url = $_REQUEST['url'];
$command = "phantomjs cread.js " . $url;
@exec($command,$content);
echo $content[0];
Read More:
- JavaScript / JS native dynamic introduction of external CSS files and dynamic insertion of CSS code fragments
- ERR_CONTENT_DECODING_FAILED error occurs in PHP program, summary of solutions
- Solution of U disk content hidden by virus
- The difference between “?” and “?:” introduced by php7
- Error report and solution of PHP module introduced by Apache
- The version number of robot JS running by electron does not match
- Uncaught Error: Script error for ” popper.js “, needed by: bootstrap solution
- Error: ‘default’ is not exported by node_ modules/qs/lib/ index.js
- Error in downloading update creation environment of CONDA: collecting package metadata (current_ repodata.json): failed
- After upgrading php7, PHP program prompts an error: operator not supported for strings in causes and Solutions
- Caused by: java.lang.IllegalStateException: Ambiguou There is already ‘XXXXXXController‘ bean method
- Method of modifying file and folder permission by Chmod command in Linux
- An error occurred while collecting items to be installed
- PHP message: PHP Fatal error: Uncaught PDOException: SQLSTATE[08004] [1040] Too many connections
- PHP link database error PHP_ network_ getaddresses: getaddrinfo failed: Name or service not known
- The error of GetSet method encapsulated by idea2020 is red
- The processing method after deleting idea’s. IML file by mistake
- php open(/var/lib/php/session/sess_4ofxxx, O_RDWR) failed: Permission denied (13)
- A simple method of generating secret key by GIT and configuring SSH public key
- solve events.js:174 Throw er; / / error reported by unhandled ‘error’ event