How to access the content of a webpage?

Discussion in 'JavaScript and AJAX' started by venami, Oct 12, 2009.

  1. venami

    venami New Member

    Joined:
    Dec 26, 2008
    Messages:
    195
    Likes Received:
    10
    Trophy Points:
    0
    Occupation:
    Software Professional
    Location:
    India, Tamil Nadu, Cuddalore
    Home Page:
    http://mvenkatapathy.wordpress.com
    Hi all,

    I was trying to get the contents from a dynamic webpage. In Javascript, I was able to access the Window object and access all the elements of the current webpage. Likewise, how can I access any other webpage and access its content?

    My idea is to create a frame in my webpage and load the page(which I wanted to access), into that frame. Then I will have control over the elements of my target webpage and so can access the contents.

    Is there a better/easy way to do it?
     
  2. venami

    venami New Member

    Joined:
    Dec 26, 2008
    Messages:
    195
    Likes Received:
    10
    Trophy Points:
    0
    Occupation:
    Software Professional
    Location:
    India, Tamil Nadu, Cuddalore
    Home Page:
    http://mvenkatapathy.wordpress.com
    To make my question clear, I need the PHP's "file_get_contents()" equivalent logic for JavaScript. I could not find any solution for my issue.
     
  3. SaswatPadhi

    SaswatPadhi ~ Б0ЯИ Τ0 С0δЭ ~

    Joined:
    May 5, 2009
    Messages:
    1,342
    Likes Received:
    55
    Trophy Points:
    0
    Occupation:
    STUDENT !
    Location:
    Orissa, INDIA
    Home Page:
    http://www.crackingforfun.blogspot.com
    I had to solve a very similar issue while preparing the G4EF toolbar.

    Actually you may use XMLHttpRequest to get the page. [[ You can use it to transfer not only HTTP stream but also XML ]].
    But I faced a lot of problem while accessing the DOM of the downloaded page. :(

    So, I had to create a hidden frame and open the page within it.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice