function GetPJData(APage: Integer): string;
var
IdHTTP: TIdHTTP;
url: string;
paramsList: TStringList;
StrStream: TStringStream;
const
C_URL = 'https://www.tcpjw.com/OrderList/TradingCenter';//?pageIdx=%d';
begin
IdHTTP := TIdHTTP.Create(nil);
try
IdHTTP.Request.Accept := '*/*';
// IdHTTP.Request.AcceptEncoding := 'gzip, deflate, br';
IdHTTP.Request.AcceptLanguage := 'zh-CN,zh;q=0.9';
IdHTTP.Request.UserAgent := 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36';
IdHTTP.Request.Referer := 'https://www.tcpjw.com/OrderList/TradingCenter';
IdHTTP.Request.ContentType := 'application/x-www-form-urlencoded'; url := C_URL;// Format(C_URL, [APage]);
OutputDebugString(pchar(url));
paramsList := TStringList.Create;
try
paramsList.Add('pt_keywords=');
paramsList.Add('pt_pricestart=');
paramsList.Add('pt_priceend=');
paramsList.Add('sy_starttime=');
paramsList.Add('sy_endtime=');
paramsList.Add('pt_laststarttime=');
paramsList.Add('pt_lastendtime=');
paramsList.Add('pt_rate=');
paramsList.Add('pt_mswsxf=');
paramsList.Add('pt_mswstart=');
paramsList.Add('pt_mswend=');
paramsList.Add('pt_tradestatus=');
paramsList.Add('pt_bid=');
paramsList.Add('pt_lasttime=');
paramsList.Add('pt_flawstatus=');
paramsList.Add('pt_price=');
paramsList.Add('orderstatus=1');
paramsList.Add('pageIdx_client='+APage.ToString);
paramsList.Add('ordercolumn=');
paramsList.Add('ordertype=');
paramsList.Add('ttype=');
paramsList.Add('X-Requested-With=XMLHttpRequest'); StrStream := TStringStream.Create('', TEncoding.UTF8);
try
try
IdHTTP.Post(url, paramsList, StrStream); if IdHTTP.ResponseCode = then
Result := StrStream.DataString
else
Result := '';
except
on e: Exception do
SendLog(TDataCollector.MainHandle, 'GetPJData: ' + e.Message, True);
end;
finally
StrStream.Free;
end;
finally
paramsList.Free;
end;
finally
IdHTTP.Free;
end;
end;