php-phantomjs icon indicating copy to clipboard operation
php-phantomjs copied to clipboard

empty response

Open gkalligeros opened this issue 9 years ago • 7 comments

Hello I'm trying to run the basic usage example on windows but i keep getting empty response object(JonnyW\PhantomJs\Http\Response)[2135] public 'headers' => array (size=0) empty public 'status' => null public 'content' => null public 'contentType' => null public 'url' => null public 'redirectURL' => null public 'time' => null public 'console' => null

gkalligeros avatar Sep 01 '16 13:09 gkalligeros

Try installing the executable from the website and pointing the installation at it.

$client = Client::getInstance();
$client->getEngine()->setPath('\path\to\phantomjs\executable.exe');

I'm not sure if the path should use backslashes or forward slashes with your environment so change accordingly.

jonnnnyw avatar Sep 01 '16 15:09 jonnnnyw

i solved this issue but now when i try to execute the Outputting a page as PDF (or jpg)
example ,the $client->send($request, $response); never returns

gkalligeros avatar Sep 01 '16 15:09 gkalligeros

I have the same issue, @gkalligeros PLZ how did you solve it? thx ! the returned response is : object(JonnyW\PhantomJs\Http\Response)#581 (8) { ["headers"]=> array(0) { } ["status"]=> NULL ["content"]=> NULL ["contentType"]=> NULL ["url"]=> NULL ["redirectURL"]=> NULL ["time"]=> NULL ["console"]=> NULL }.

atefBB avatar Dec 28 '16 12:12 atefBB

setPath fixed it for me, I was able to determine the path by running which phantomjs from the command line.

hillelcoren avatar Jan 02 '17 18:01 hillelcoren

I solve the issue by doing this : $client->getEngine()->setPath(base_path() . '/vendor/bin/phantomjs'); (base_path is a laravel helper function) setPath to ~/phantomjs.exe may cause prob (in this case, I'm using debian server) ! Hope that help someone !

atefBB avatar Jan 03 '17 09:01 atefBB

Same problem for me and $client->getEngine()->setPath() has not resolved the issue...

Djibdjib avatar Mar 01 '17 16:03 Djibdjib

I think proc file is failed。。。Because i'm not use proc file can return right.

wpjCode avatar Jan 25 '19 01:01 wpjCode