Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    New Coder
    Join Date
    Dec 2006
    Location
    GB
    Posts
    79
    Thanks
    3
    Thanked 1 Time in 1 Post

    get_file_contents, rendered JS?

    Is there a way to get_file_contents AFTER a page has had it's javascript rendered?

    Thanks, Jack.

  • #2
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,042
    Thanks
    19
    Thanked 42 Times in 42 Posts
    umm you mean like
    get_file_contents(http://www.yoursite.com/yes/js/is/rendered.php);

  • #3
    New Coder
    Join Date
    Dec 2006
    Location
    GB
    Posts
    79
    Thanks
    3
    Thanked 1 Time in 1 Post
    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.

  • #4
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,042
    Thanks
    19
    Thanked 42 Times in 42 Posts
    btw function is file_get_contents() not get_file_contents()

  • #5
    New Coder
    Join Date
    Dec 2006
    Location
    GB
    Posts
    79
    Thanks
    3
    Thanked 1 Time in 1 Post
    Ok, but any idea about rendering the javascript?

  • #6
    New to the CF scene
    Join Date
    Jun 2007
    Location
    NW Indiana, United States, Earth
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you are using Firefox, the View Source Chart extension should be what you are looking for.

  • #7
    New Coder
    Join Date
    Dec 2006
    Location
    GB
    Posts
    79
    Thanks
    3
    Thanked 1 Time in 1 Post
    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.

  • #8
    New to the CF scene
    Join Date
    Jun 2007
    Location
    NW Indiana, United States, Earth
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #9
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    without something that parses javascript (so either browser, or a standalone engine- look for spidermonkey or rhino) then the answer is no.
    My thoughts on some things: http://codemeetsmusic.com
    And my scrapbook of cool things: http://gjones.tumblr.com

  • #10
    New Coder
    Join Date
    Dec 2006
    Location
    GB
    Posts
    79
    Thanks
    3
    Thanked 1 Time in 1 Post
    Spidermonkey is a serverside engine that parses javascript?

  • #11
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    My thoughts on some things: http://codemeetsmusic.com
    And my scrapbook of cool things: http://gjones.tumblr.com

  • #12
    New Coder
    Join Date
    Dec 2006
    Location
    GB
    Posts
    79
    Thanks
    3
    Thanked 1 Time in 1 Post
    Hmm, how do I actually use this then?

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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •