Saturday 29 April 2017

Getting Checking your browser before accessing template and 503 status code with https.request(options,callback) node.js

I want to get the html of this page for parsing(click the link to understand what content i want to get).

750-bond list

Here's my code to request this page content

    var https = require("https");

    var fs = require("fs");

var options = {
    hostname: "www.prizebond.net",
    port: 443,
    path: "/dlist.php?num=455",
    method: "GET"

};

var response = "";

var req = https.request(options, function (res) {
    res.setEncoding("UTF-8");
    console.log(res.statusCode);
    res.on("data", function (chunk) {
        response += chunk;
    });

    res.on("end", function () {

        fs.writeFile("750-bond.html", response, function (err) {

            if (err) {
                console.log(err.message);
            }
            console.log("File downloaded");

        });
        console.log("end");

    });
});

req.end();

Now the problem is that in my 750-bont.html file, I am getting the weird the result of "Checking your browser before accessing the prizebond.net" not the original content. Here's the screenshot what I got when I open the 750- bond.html file in browser.

750-bond.html

What I am doing wrong? And how can I get the original content of this webpage?



via Alturistic

No comments:

Post a Comment