PHP code example of workdigital / casperjs-php-driver
1. Go to this page and download the library: Download workdigital/casperjs-php-driver library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
workdigital / casperjs-php-driver example snippets
$driver = new CasperJs\Driver();
$output = $driver->start('http://someurl.com')
->run();
$driver = new CasperJs\Driver();
$driver->start('http://someurl.com')
->setUserAgent('AmericanPizzaiolo')
->setHeaders([
'Accept-Language' => ['en-US'],
'Some-Header' => 'Foo-bar',
])
->evaluate('make me a pizza')
->setViewPort(1024, 768)
->waitForSelector('.selector', 30000)
->wait(10000)
->click('.selector');
$output = $driver->run();
$driver = new CasperJs\Driver();
$driver->start('http://someurl.com')
->useProxy('1.1.1.1');
$output = $driver->run();