Jump to content

xmlhttp request object to xmldom object


mugs

Recommended Posts

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..

Link to comment
https://forums.phpfreaks.com/topic/141106-xmlhttp-request-object-to-xmldom-object/
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.