javascript - how to get a document object from a given url in node js -


how can using node.js api document of given url work with. here snippet of come :

var needhttp  = require('http');  var getallfromsite = function ( siteurl, tag)  {  var requesttourl = needhttp.get( siteurl, function (responsefromurl) {  responsefromurl. somehowgetdocument...   });   } 

so far i've found this, still needs domparser 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"); } 

Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -