A
A
asosonko42016-02-12 19:18:44
PHP
asosonko4, 2016-02-12 19:18:44

Why is PHP PhantomJS not working?

The problem is this: installed php phantomjs on MAMP. I did everything according to the instructions from here
. Everything was installed and working well ... Then I copied the files from my hosting and everything stopped working. I did a var_dump of the server response, as I understand it, and got the following:

object(JonnyW\PhantomJs\Http\Response)#156 (8) { ["headers"]=> NULL ["status"]=> NULL ["content"]=> NULL ["contentType"]=> NULL [" url"]=> NULL ["redirectURL"]=> NULL ["time"]=> NULL ["console"]=> NULL }

Why might it not work, and actually all return values ​​are 0? My code is below:
require __DIR__ . '/vendor/autoload.php';

use JonnyW\PhantomJs\Client;

$client = Client::getInstance();

$request = $client->getMessageFactory()->createRequest('http://jonnyw.me', 'GET');

$response = $client->getMessageFactory()->createResponse();

var_dump($response);

$client->send($request, $response);


echo $response->getContent();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Papa, 2016-02-13
@asosonko4

1. Because var_dump($response) comes before $client->send().
2. For PHP PhantomJS to work, PhantomJS itself (a binary executable file) is needed, in fact. And on shared hosting, I think it is unrealistic to install / run it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question