Saturday, April 7, 2018

Yii2 phantomjs

First of all you need to install Yii2 phantomjs extension using below Command
$ composer require "jonnyw/php-phantomjs:4.*"

Phantomjs Usage:

use JonnyW\PhantomJs\Client;
    $c = Client::getInstance();
    $request = $c->getMessageFactory()->createRequest('http://example.com', 'GET');
    $res = $c->getMessageFactory()->createResponse();
    // Make the request
    $c->send($request, $res);
    if($res->getStatus() === 200) {
        echo $res->getContent();

No comments:

Post a Comment

Recent Update

yii2 session handling

use yii\web\Session; $session = Yii::$app->session; // start session $session->open(); // close session $session->close(); ...

Most Search