javascript-console.php 540 B

123456789101112131415161718192021
  1. <?php
  2. require '../vendor/autoload.php';
  3. use JonnyW\PhantomJs\Client;
  4. $client = Client::getInstance();
  5. $request = $client->getMessageFactory()->createRequest();
  6. $response = $client->getMessageFactory()->createResponse();
  7. $request->setMethod('GET');
  8. $request->setUrl('http://google.com');
  9. $client->send($request, $response);
  10. // Any javascript errors that show up in
  11. // the browser console will appear in
  12. // response console data along with stack
  13. // trace. console.log() data will not be present.
  14. var_dump($response->getConsole());