XMLHTTPClass does not always retrieves remote URL data - some sites work - some Don't is there a better way to scrape?


This works using one remote URL

but not a second one www.cnn.com
Will not work with a call to cnn - here's the response.

Not Found The requested URL / was not found on this server.</p>\n<hr />\n<address>Apache Server at www.cnn.com Port 80</address>\n</body></html>\n"

IS there a better way?


string postData = "";
string uriString = "http://www.cnn.com";
string strXML ;

XMLHTTPClass xmlHTTP = new XMLHTTPClass();

xmlHTTP.open("POST", uriString,false,null,null) ;
xmlHTTP.send(postData) ;

while(xmlHTTP.readyState != 4)
strXML = (string)xmlHTTP.responseText;

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use this in client side JS

<body onload="init()">
<input value="view Yahoo" type="button" onclick="alert(document.getElementById('yahoo').innerHTML)">
<input value="view ebay"type="button" onclick="alert(document.getElementById('ebay').innerHTML)"> <p>
function LoadPage(theURL,theID){
   var objSrvHTTP;
          objSrvHTTP = new ActiveXObject("Msxml2.XMLHTTP.4.0");
               objSrvHTTP = new ActiveXObject("Msxml2.XMLHTTP");
                    objSrvHTTP = new ActiveXObject("Microsoft.XMLHTTP");
                    alert("ok you have Microsoft.XMLHTTP")
                    alert("you need install MSXML 4.0, http://www.microsoft.com/downloads/");
       objSrvHTTP.open ("GET",theURL,false);
       objSrvHTTP.send ("");

function init(){

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
thanks for the points
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.