doba
doba

Reputation: 25

PhantomJS return empty body

I send request with headers(X-CSRF-Token, cookie etc) and get empty response, but when I do same with postman(chrome extension) I get correctly response.

Example of response (something like this):

<a href="img1.jpg" data-gallery><img src="img11.jpg" alt="" /></a>
<a href="img2.jpg" data-gallery><img src="img21.jpg" alt="" /></a>

UPD:

my code

page.open(url, settings, function(status, a, b) {  
  var response = page.evaluate(function() {
    return document.body.outerHTML
  });
  console.log('>>', JSON.stringify(response))
});

run:

phantomjs --ssl-protocol=TLSv1 --debug=no --load-images=no --ignore-ssl-errors=yes --web-security=true test.js

Upvotes: 1

Views: 1080

Answers (1)

Marcin Żurek
Marcin Żurek

Reputation: 151

This 2 params should be added: --ignore-ssl-errors=true --ssl-protocol=any to phantomjs run command

Upvotes: 1

Related Questions