user1614427
user1614427

Reputation:

How can I cURL with JavaScript turned on?

I need to load content from a remote uri into a PHP variable locally. The remote page only shows content when JavaScript is turned on. How can I get around this?

Essentially, how can I use cURL for pages requiring JavaScript loaded content?

Upvotes: 1

Views: 6624

Answers (2)

dm03514
dm03514

Reputation: 55952

Mink was the only php headless browswer that I could find. As noted selenium is another popular choice. I don't know how good of performance these will offer though if you have a lot of scraping to do. They seem to be more geared towards testing?

A number of other languages have them which are listed in the link below. Since php does does not process javascript you will need another tool. Headless browswers expose the javascript engine and allow you to interact with the browser programattically.

headless internet browser?

Upvotes: 3

sean
sean

Reputation: 3985

To do this you have to emulate a browser using a browser plugin such as selenium. This will involve slightly more than just a simple get request though.

http://seleniumhq.org/

Upvotes: 1

Related Questions