html如何获得网址,已知一个网址,如何获得该网址对应的html源代码?在del 找人事管理软件...
銷售管理軟件版1樓: 已知一個(gè)網(wǎng)址,如何獲得該網(wǎng)址對(duì)應(yīng)的html源代碼?在delphi中如何實(shí)現(xiàn)?今天不解決,沒飯吃了。。。
2樓: 用WebBrowser控件,先把網(wǎng)址傳給WebBrowser,然后在想辦法。因?yàn)闉g覽網(wǎng)頁(yè)時(shí),在本地緩存中都保留文件,在Temporary Internet Files目錄中找到該文件即可。
或者直接在WebBrowser上想辦法,因?yàn)閃ebBrowser本來就是為瀏覽html而做的 如人事管理軟件
3樓: //html->
function TShowEmailInfoFrm.ShowEmailInfo(EmailStr: WideString): Boolean;
var
htmldocument : ihtmldocument2;
begin
Result:=False;
try
htmldocument := EmailBrower.Document as IHTMlDocument2;
htmldocument.body.innerHTML :=EmailStr;
Result:=True;
except
end;
end;
//->html
function TShowEmailInfoFrm.ShowEmailInfo(): WildString;
var
htmldocument : ihtmldocument2;
begin
try
htmldocument := EmailBrower.Document as IHTMlDocument2;
result:=htmldocument.body.innerHTML ;
except
end;
end;
procedure TShowEmailInfoFrm.FormCreate(Sender: TObject);
begin
EmailBrower.Navigate(''about:blank'');
EmailBrower.Navigate(''你的url'');
end;
4樓: 用idhttp
5樓: function UrlGetStr(const URL: string; ShowHeaders: boolean = false): string;
{--------------獲取網(wǎng)頁(yè)代碼函數(shù)-----------------}
const
Agent = ''Internet Explorer 6.0'';
var
hFile, HInet: HINTERNET;
Buffer: array[0..32767] of Char;
BufRead: Cardinal;
BufSize: Cardinal;
TempStream: TStringStream;
dwIndex: dword;
begin
HInet := InternetOpen(PChar(Agent), INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
if Assigned(HInet) then
try
if LowerCase(Copy(URL,1,7)) <> ''http://'' then
hFile := InternetOpenUrl(HInet, PChar(''http://'' + URL), nil, 0, 0, 0)
else
hFile := InternetOpenUrl(HInet, PChar(URL), nil, 0, 0, 0);
TempStream := TStringStream.Create('''');
dwIndex := 0;
BufSize := SizeOf(Buffer);
HttpQueryInfo(hfile, HTTP_QUERY_RAW_HEADERS_CRLF, @Buffer, BufSize, dwIndex);
if ShowHeaders then TempStream.Write(Buffer, BufSize);
if Assigned(hFile) then
try
with TempStream do
try
while InternetReadFile(hFile, @Buffer, BufSize, BufRead) and (BufRead > 0) do
Write(Buffer, BufRead);
Result := DataString;
finally
Free;
end;
finally
InternetCloseHandle(hFile);
end;
finally
InternetCloseHandle(hinet);
end;
end;
6樓: 用IdHTTP組件應(yīng)該是最簡(jiǎn)的,
s: TStringStream;
IdHTTP.Get(''http://www.sohu.com'',s);
ShowMessage(s.DataString);
銷售管理軟件版7樓: 我剛剛做了一個(gè).很簡(jiǎn)單的.用IdHttp的Get方法.再用多線程.速度可以很快的.
8樓: 多人接受答案了。
總結(jié)
以上是生活随笔為你收集整理的html如何获得网址,已知一个网址,如何获得该网址对应的html源代码?在del 找人事管理软件...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 河北省往届高考成绩查询2021,2021
- 下一篇: win8.1 计算机放在桌面,Win8.