• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

PHP reading webpage

MrScott81

Golden Member
I'm trying to read the contents of a webpage with a php script. Normally, this is no problem, however, parts of the webpage I'm trying to read get updated with javascript on the page. Does anyone know of a way to have the javascript "process" before reading the page?
 
PHP runs server side. Javascript runs client side. The best route is probably to use a browser to load the page you want, then traverse the DOM to get what you need. I guess you could use a page generated in PHP and load an IFRAME with the page you want, but you'd still need Javascript on your page to get the data you want because, again, PHP is server side so once the page is loaded the server is done.
 
PHP runs server side. Javascript runs client side. The best route is probably to use a browser to load the page you want, then traverse the DOM to get what you need. I guess you could use a page generated in PHP and load an IFRAME with the page you want, but you'd still need Javascript on your page to get the data you want because, again, PHP is server side so once the page is loaded the server is done.

Presumably the page is originating from a different server than the one the PHP script is running on, so from the perspective of the machine serving the page, the PHP script *is* the client.

Anyway.

What the OP needs is something like Mozilla's XULRunner, which is essentially a headless Firefox engine. Some related tools and suggestions here.
 
Back
Top