1

I research a PHP library that allows to execute javascript code on html content to obtain HTML modified content without browser.

The steps are :

  1. Get a page with curl or file get content
  2. Apply a javascript script to the page.
  3. Save the result page in a file on server.

All in one php script.

Edit :

My goal is to get the result of a php web page after applying a javascript function on this page to change some things.

Is there a PHP library that allows to execute the javascript code of a page Without going through a browser, and return the results in HTML?

6
  • php doesn't run javascript, browsers do.
    – dandavis
    Commented Apr 19, 2015 at 5:56
  • yes it is possible ! have you tried that ?
    – Farshad
    Commented Apr 19, 2015 at 5:58
  • 2
    i can't help but think that a platform other than php would be better-suited for your task. you can do #1 and #3 in JS, but you can't do #2 in php...
    – dandavis
    Commented Apr 19, 2015 at 6:03
  • May be NodeJs not php
    – Fares M.
    Commented Apr 19, 2015 at 6:24
  • 1
    I have found this : apifier.com Commented Nov 6, 2015 at 4:14

1 Answer 1

2

Ok, I have found a solution here :

Execute javascript in PHP

Using HtmlUnit is a "GUI-Less browser for Java programs".

http://htmlunit.sourceforge.net/

Not the answer you're looking for? Browse other questions tagged or ask your own question.