Guest User

Untitled

a guest
Jan 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <a href="#" class="text-dark launch" id="<?php echo $row->id; ?>"> Launch</a>
  2.  
  3. $('.launch').on('click', function () {
  4. $.ajax({
  5. type: 'POST',
  6. url: 'http://localhost/sample/run_scrape',
  7. success: function (status) {
  8. console.log(status);
  9. }
  10. });
  11. });
  12.  
  13. public function run() {
  14.  
  15. $html = shell_exec("phantomjs C:samplescraper.js");
  16. echo json_encode($html);
  17. }
  18.  
  19. var page = require('webpage').create();
  20. page.open('https://detectmybrowser.com/', function(status){
  21. console.log("Status: " + status);
  22. if(status === "success"){
  23. page.render('example.png');
  24. }
  25. phantom.exit();
  26. });
Add Comment
Please, Sign In to add comment