- Load webpages through the PhantomJS headless browser
- View detailed response data including page content, headers, status code etc.
- Handle redirects
- View detailed PhantomJS debuged information
- Save screen captures to local disk
- Set viewport size
- Define screen capture x, y, width and height parameters
- Delay page rendering for a specified time
- Execute PhantomJS with command line options
- Easily build and run custom PhantomJS scripts
PHP PhantomJS requires PHP 5.3.0 or greater to run.
It is recommended that you use Composer to install PHP PhantomJS. First, add the following to your project’s
This will ensure the latest version of PhantomJS is installed for your system, in your bin folder. If you haven’t defined your bin folder in your composer.json, add the path:
Finally, install PHP PhantomJS from the root of your project:
If you would like to use another installation method or would like to see more detailed installation instructions, see the installation documentation.
The following illustrates how to make a basic GET request and output the page content:
And if you would like to save a screen capture to local disk: