2017 © Pedro Peláez
 

library phantomjs-cloud

PhantomJS Cloud API wrapper

image

cfv1000/phantomjs-cloud

PhantomJS Cloud API wrapper

  • Sunday, January 14, 2018
  • by cfv1000
  • Repository
  • 2 Watchers
  • 1 Stars
  • 53 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 13 % Grown

The README.md

PhantomJS Cloud

A library to interact with the Phantom JS Cloud, (*1)

Examples and extensive documentation on the API https://phantomjscloud.com/docs/http-api/, (*2)

Simple example

Write the web page to a JPG file:, (*3)


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

This example shouldn't be used in production. If you need to perform advanced HTTP requests to the api, please address a dedicated library for that. This library should be used only to write your requests, (*4)

Guzzle Example


include_once __DIR__ . '/vendor/autoload.php'; /** * 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();

TODO - What we plan next for this code

  • have a directory structure that will allow you to separate PhantomJS classes from helper classes
  • migrate public arguments to protected arguments where possible and use setters and getters.
  • see TODO's in the class comments
  • add examples in the documentation

The Versions

14/01 2018

dev-master

9999999-dev

PhantomJS Cloud API wrapper

  Sources   Download

MIT

by Flaviu Chelaru

02/05 2017

1.0.3

1.0.3.0

PhantomJS Cloud API wrapper

  Sources   Download

MIT

by Flaviu Chelaru

30/04 2017

1.0.2

1.0.2.0

PhantomJS Cloud API wrapper

  Sources   Download

MIT

by Flaviu Chelaru

30/04 2017

1.0.1

1.0.1.0

PhantomJS Cloud API based on Guzzle

  Sources   Download

by Flaviu Chelaru

28/04 2017

1.0.0

1.0.0.0

PhantomJS Cloud API based on Guzzle

  Sources   Download

The Requires

 

by Flaviu Chelaru