別のアプリケーションからWebページを取得するDelphi関数を作成しました。
これは、ファイルを使用して情報を保存するときに正常に機能します。
結果:= URLDownloadToFile(nil、PChar(XmlUrl)、PChar(XmlFileName _)、0、nil);
URLOpenBlocking-streamを使用すると正しい情報が得られますが、2回目にWebサーバーにリクエストを実行すると、ページが変更されていても古いページが表示されます。
誰かが原因が何であるかについての考えを持っていますか?
function MyDownloadToBlockingSteam( URL : String; Var bsXmlStr : AnsiString): LongInt;
var
ppStream : ActiveX.IStream;
statstg : TStatStg;
dwRead : Integer;
begin
Result := 1;
bsXmlStr := '';
If (URLOpenBlockingStream(nil, PChar(URL), ppStream, 0, nil) = S_OK) then
Begin
// Resource protection
try
if (ppStream.Stat(statstg, STATFLAG_NONAME) = S_OK) then // Get the stat from the IStream interface
begin
if (statstg.cbSize > 0) then // Make sure size is greater than zero
begin
SetLength ( bsXMLStr, statstg.cbSize+1 );
Result := ppStream.Read( @bsXMLStr[1], statstg.cbSize, @dwRead); // Read from the stream
end;
end;
finally
ppStream:=nil; // Release the IStream interface
end;
end;//If ..
end;