0

How can I using only Node.js API get a document of a given URL to work with. Here is a snippet of what i come up with :

var needHttp  = require('http');

var getAllFromSite = function ( siteUrl, tag) 
{

var requestToURL = needHttp.get( siteUrl, function (responseFromURL) {

responseFromURL. SOMEHOWgetDOCUMENT...
  }); 

}
1

1 Answer 1

0

So far I've found this, but still it needs DOMParser which I could't find:

function getSourceAsDOM(url)
{
xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET",url,false);
xmlhttp.send();
parser=new DOMParser();
return parser.parseFromString(xmlhttp.responseText,"text/html");
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.