使用脚本下载网页

来源:CSDN 作者: 2005-10-10 出处:pcdog.com


  // The URL to download 
var url = "http://www.aboutnt.com/default.htm" 
// Create instance of Inet Control 
inet = new ActiveXObject("InetCtls.Inet"); 
// Set the timeout property 
inet.RequestTimeOut = 20; 
// Set the URL property of the control 
inet.Url = url; 
// Actually download the file 
var s = inet.OpenURL(); 
// Show the raw HTML to the user 
WScript.Echo( s ); 
// Bonus - Find the title of the page 
// Regular expression to find the string stored between 
// the title tags. 
rtitle = /<title>(.*)<\/title>/i; 
// Execute the regular expression on the raw HTML 
var title = rtitle.exec( s ); 
// Display the result 

上一篇:CGI的安全(二)
下一篇:Perl/Tk FAQ - 10.17. 如何隐藏密码输入框中的内容?