Nodejs timed access to Web pages

Source: Internet
Author: User
/** * Created by Administrator on 2018/2/25 0025. */var https = require(‘http‘);var schedule = require(‘node-schedule‘);var rule = new schedule.RecurrenceRule();// rule.second = [0,10,20,30,40,50];//隔十秒// rule.hour =0;rule.minute =0;rule.second =0;//每天0点执行rule.minute = [0,20,40];//每小时的0分钟,20分钟,40分钟执行var j = schedule.scheduleJob(rule, function(){ httpGet(); console.log(‘现在时间:‘,new Date());});function httpGet() { var uri = "http://baidu.com" https.get(uri, function (res) { console.log("状态码: " + res.statusCode); })}

Nodejs timed access to Web pages

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.