세션ID는 재주껏 가져오자.
쿠키에 저장되어 있으니.

TWebBrowser에서 세션ID 가져오기 : http://bloodguy.tistory.com/entry/Delphi-TWebBrowser에서-세션아이디SessionID-가져오기



// URL에서 도메인명만 따냄
function GetHostNameFromURL(URL: String): String;
var PosSlash: Integer;
begin
  Result:=Trim(URL);

  Result:=MidStr(Result, Pos('://', Result)+3, Length(Result));
  PosSlash:=Pos('/', Result);
  if PosSlash>0 then Result:=MidStr(Result, 1, PosSlash-1);
end;

// 세션ID를 포함하여 GET 요청
function GetWithSessionID(URL, SessID: String): String;
var
  HTTP: TIdHTTP;
  Cookie: TIdCookieManager;
  HostName: String;
begin
  Result:='';

  HTTP:=TIdHTTP.Create(nil);
  Cookie:=TIdCookieManager.Create(nil);
  try
    HTTP.CookieManager:=Cookie;
    Cookie.AddCookie('PHPSESSID='+SessID, GetHostNameFromURL(URL));
    try
      Result:=HTTP.Get(URL);
    except on E:Exception do
      OutputDebugString(PWideChar(E.Message));
    end;
  finally
    FreeAndNil(Cookie);
    FreeAndNil(HTTP);
  end;
end;








Posted by bloodguy
,