mugs Posted January 16, 2009 Share Posted January 16, 2009 hello! i m currently workin on a project in my college which involves reading data from a normal internet web page.. my question is how can i do it?? i hv tried using using xmlhttp request obj bt it jst works wen i send a request to a webpage stored locally on my machine n nt over the internet.. also i wish to extract the data within the responseText tht i get.. in the sense tht i want to get the data within the various tags, eg i m nt interested whether there is <table> or a <div> or a <p> tag, i jst want whatever is written in it.. this can be done using the xmldom.getElementsByTagName option i think, bt the prob is hw do i convert the responseText to a xmldom object.. please help.. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted January 16, 2009 Share Posted January 16, 2009 AJAX only allows you to make requests to the same domain (for security reasons). to access external html, you need to run it through a local script: -http://host1.com/index.php uses ajax to call http://host1.com/external.php -http://host1.com/external.php uses php and curl or fopen to access http://host2.com/page.php -http://host1.com/external.php returns the contents from the previous step Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.