Jinu Joseph Daniel
Jinu Joseph Daniel

Reputation: 6291

Embedding a web browser within a php script

In my project I have to do some screen scrapping.The source pages return data after executing the javascript embedded within them.In my php script I fetch the page using file_get_contents() and as usual,it returns the page simply as text.My question is that,is there a way to get the final output from the webpage (the output after executing javascript).

I know some of you might suggest embedding a webbrowser inside and using that to execute the page.But how to do that?.Is there a working browser available.Or is there executable non GUI versions of opensource browsers such as chromium,so that I can run it as a CGI script or something

Upvotes: 1

Views: 3233

Answers (1)

complex857
complex857

Reputation: 20753

You will have to have some real browser like client for this, php alone won't cut it. For automation purposes you are most likely want a "headless" (without gui) browser like PhantomJS (the new hotness). Check out this answer.

Upvotes: 4

Related Questions