Loading

PhatomJS

下载地址:http://phantomjs.org/download.html

官方文档:http://phantomjs.org/quick-start.html

第一段代码

var page = require('webpage').create(); //给用户提供了访问、操作、选择web文档的接口
phantom.outputEncoding = 'gbk';    //编码格式
page.open("http://www.cnblogs.com/imaye/",function(status){
    if(status=="success")
    {
        console.log(page.title);
    }
    else{
        console.log("open failed");
    }
    phantom.exit(0);    //退出phantomjs执行环境
});

 

posted @ 2018-04-10 18:42  ichar  阅读(150)  评论(0编辑  收藏  举报