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

Getting a empty response

Open themendelson opened this issue 7 years ago • 2 comments

This is my code: `use JonnyW\PhantomJs\Client; use JonnyW\PhantomJs\DependencyInjection\ServiceContainer;

$engine = new engine; $engine->Start();

$client = Client::getInstance(); //$client->isLazy(); $client->getEngine()->setPath(DIR ."/engine/plugins/phantomjs/bin/phantomjs"); $client->isLazy(); $request = $client->getMessageFactory()->createCaptureRequest('http://www.relogs.co.il/'); $response = $client->getMessageFactory()->createResponse();

$file = "file.jpg";

$request->setOutputFile($file);
$request->setTimeout(10000);
$client->send($request, $response);

var_dump($response);`

I'm getting the following response: object(JonnyW\PhantomJs\Http\Response)#173 (9) { ["headers"]=> array(0) { } ["status"]=> NULL ["content"]=> string(26) "" ["contentType"]=> NULL ["url"]=> string(24) "http://www.relogs.co.il/" ["redirectURL"]=> NULL ["time"]=> string(24) "2017-08-15T19:05:07.606Z" ["console"]=> array(0) { } ["cookies"]=> array(0) { } }

The weird thing is - When I change the URL to google.com or http://jonnyw.me (only these 2 work so far), everything goes perfect. I'm using Ubuntu 17.xx and I already tried changing 5 versions of phantomJS. All of them give me the same response.

themendelson avatar Aug 15 '17 19:08 themendelson

I'm getting the same thing on a CentOS server. It was working perfectly for me within my Windows XAMPP environment.

LiamMcArthur avatar Sep 13 '17 14:09 LiamMcArthur

I'm having the same issue on centos. Not using php-phantom, just phantom. Most resources get a null but some get a 202. A certain domain gets all nulls

maggiesavovska avatar Sep 29 '17 20:09 maggiesavovska