PHP code example of cfv1000 / phantomjs-cloud

1. Go to this page and download the library: Download cfv1000/phantomjs-cloud 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/ */

    

cfv1000 / phantomjs-cloud example snippets




$request = new \PhantomJS\PageRequest('http://www.example.com');
file_put_contents('example.com.jpg', $request->getResponse());

 

/**
 * write your phantom js request
 * @see https://phantomjscloud.com/docs/
 */
$request = new \PhantomJS\PageRequest('http://www.example.com');

/**
 * Initialize Guzzle to perform HTTP requests
 * @see http://docs.guzzlephp.org/en/stable
 * The request url will be https://phantomjscloud.com/api/browser/v2/a-demo-key-with-low-quota-per-ip-address/?request={url:%22http://www.example.com%22}
 */
$client = new GuzzleHttp\Client();
$response = $client->get($request->getApiUrl() . '?request=' . $request->toJSON());
print $response->getBody();