PhantomJS HTTP Client

PhantomJS logo

PhantomJS is a webkit implementation that helps to simulate the real browser.


By using this client you will execute the inner javascript code and make the DOM as real as in the true browser, that can be required for some search engines to work properly.

Notice about cookies

At the current state phantomJS adapter does not support internal cookieJar usage.

Installation

The client is available with the package serps/http-client-phantomjs:

$ composer require 'serps/http-client-phantomjs'

Additional requirement

PhantomJS binaries have to be installed to use the client. The process for installing it depends on your environment, you will find further guides on the internet.

The following PhantomJs version were tested with the library:

Note

The package jakoch/phantomjs-installer can help you to manage phantomJS as a dependency of your project.

Usage

use Serps\HttpClient\PhantomJsClient;

// The constructor accepts 1 optional parameter that is the path to the phantomjs binaries (default to 'phantomjs')
$client = new PhantomJsClient();