本文整理自网络,侵删。
program Project1;
{$APPTYPE CONSOLE}
{$R *.res}
uses System.SysUtils, System.Classes, System.Net.HttpClient, System.RegularExpressions;
const url = 'http://www.delphitop.com/';begin var http := THttpClient.Create; var sl := TStringList.Create; try sl.LoadFromStream(http.Get(url).ContentStream, TEncoding.ANSI); var m := TRegEx.Match(sl.Text, '<title>(.*?)</title>'); if m.Success then writeln('获取信息: ', m.Value); Readln; finally sl.Free; http.Free; end;end.
相关阅读 >>
Delphi adoconnection1连接mssql数据库方法
Delphi tserversocket 发送消息之前检查客户端是否仍处于连接状态
更多相关阅读请进入《Delphi》频道 >>