jonnnnyw/php-phantomjs — pull request #2 by Samyoul (2013-12-14 13:15:05+00:00)
Title: Added setScript() Method.

Due to the current limitations of the php mask for PhantomJS I needed to
build in a setScript method to be able to use more advanced
functionality.

The setScript method currently overrides all Request object data.

Example of usage (Using Laravel):

/** @var $client JonnyW\PhantomJs\Client */
$client = App::make("PhantomClient");

$client->setScript("https://raw.github.com/ariya/phantomjs/master/examples/technews.js");

/** @var $request JonnyW\PhantomJs\Message\Request */
$request = $client->getMessageFactory()->createRequest('GET',
'doesnotmatter.com');
$request->addHeader('User-Agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS
X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.2
Safari/534.34');

/** @var $response JonnyW\PhantomJs\Message\Response */
$response = $client->getMessageFactory()->createResponse();

// Send the request
$client->send($request, $response);