1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2006
    Rep Power

    Read Javascript Object

    I'm able to get an external sites HTML code. Inside that code they have a javascript code which has a JS object called myListItems.

    I know how to get the HTML via file_get_contents but how canI scrape the JS code so I can use it?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Rep Power
    Essentially you can't. Javascript is client side so you cannot know what is happening when executed by the user/browser. You can pull the script itself depending on if it is embedded in the HTML or pulled from a file. You would have to analyze the <javascript> tag(s) to determine which. After that you would need to know what the user/browser actions are to execute it. Finally you would have to emulate its execution on the server using the same conditions as the user/browser. All of that is virtually impossible.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.

IMN logo majestic logo threadwatch logo seochat tools logo