...

View Full Version : get_file_contents, rendered JS?



Jacka
06-29-2007, 10:41 AM
Is there a way to get_file_contents AFTER a page has had it's javascript rendered?

Thanks, Jack.

rafiki
06-29-2007, 11:50 AM
umm you mean like
get_file_contents(http://www.yoursite.com/yes/js/is/rendered.php);

Jacka
06-29-2007, 12:08 PM
Basicly, the site I want to grab the content from is all in javascript...

document.write("Hello there").

It's a little more complicated than that, but I want to let the javascript do what it does, and THEN use a get_file_contents("url") type thing.

rafiki
06-29-2007, 12:18 PM
btw function is file_get_contents() not get_file_contents()

Jacka
06-29-2007, 12:26 PM
Ok, but any idea about rendering the javascript?

pr0gr4mm3r
06-29-2007, 03:19 PM
If you are using Firefox, the View Source Chart (https://addons.mozilla.org/en-US/firefox/addon/655) extension should be what you are looking for.

Jacka
06-29-2007, 03:51 PM
You don't understand.

The site I want to use file_get_contents for is rendered using javascript, which is client side, and therefore not done when PHP gets it.

I want it to be rendered in order to use some preg_match_all to get content from within the page.

pr0gr4mm3r
06-29-2007, 03:53 PM
You can't do it using php because php doesn't process JavaScript. JS is a client-side script and thus parsed in a browser.

GJay
06-29-2007, 03:54 PM
without something that parses javascript (so either browser, or a standalone engine- look for spidermonkey or rhino) then the answer is no.

Jacka
06-29-2007, 04:35 PM
Spidermonkey is a serverside engine that parses javascript?

GJay
06-29-2007, 04:49 PM
http://www.mozilla.org/js/spidermonkey/

Jacka
06-29-2007, 05:18 PM
Hmm, how do I actually use this then?

Do I post it javascript and it returns the compiled version?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum