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. Commented Apr 19, 2015 at 5:56
  • yes it is possible ! have you tried that ? 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... Commented Apr 19, 2015 at 6:03
  • May be NodeJs not php 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/

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.