0

I need to run a site periodically using php. I used CURL but the problem is that it does not run javascript. How can i make the script access the site using php as if it were a user accessing the browser

<?php
shell_exec("curl -X POST -c cookie.txt -F 'login=bot' -F 'pass=bot@123456@' --cookie-jar 'cookie.txt' -L http://test.com");
?>

The topic marked as duplicate has NO RELATIONSHIP to what I want. I'm making a bot to access a page and run everything it has in it including javascript. But CURL does not execute javascript. I want an alternative

Bruno Andrade
  • 565
  • 1
  • 3
  • 17
  • Remove duplicate markup. What you have recommended has no connection to what I want. – Bruno Andrade Mar 06 '18 at 21:43
  • The answer in this may shed some light https://stackoverflow.com/questions/20554113/how-to-get-webcontent-that-is-loaded-by-javascript-using-curl – IncredibleHat Mar 06 '18 at 21:46
  • I know PhantomJS but I do not need to display the content. I just want the page to be executed in the background as if it were a user doing the browser. I think there must be some solution just using PHP and shell commands – Bruno Andrade Mar 06 '18 at 21:51
  • 1
    You'd think... but... there isn't. The executing javascript part (in the DOM after load) is the tricky part, as it requires all the webkit and javascript language framework in place to do all that. – IncredibleHat Mar 06 '18 at 21:53

0 Answers0