procedure TForm1.Button1Click(Sender: TObject);
var
ss:TStringList ;
s:string;
begin
ss:=TStringList.Create;
if Length( Memo4.Text)< 20 then Memo5.Lines.Add('内容太短');
if Edit18.Text ='' then Edit18.Text:=Copy(Memo4.Text,1,30) ;
//ss.Add('secret=j');
ss.Add('post_author=admin');
ss.Add('post_category=69');
ss.Add('post_title=' AnsiToUTF8(Edit18.Text));
ss.Add('post_content=' AnsiToUTF8(Memo4.Text) '');
ss.Add('post_meta=69');
ss.Add('post_status=publish');
s:= gpost('https://www.5t6t.com/Locoy.php',ss);
ss.Free;
Memo5.Text:=UTF8ToAnsi(s);
end;
function TForm1.gpost(url:String;data:TStringList):String;
var
fhttpRequest: TIdHTTP;
PostData : TStringStream;
tmpStr,s : String;
i:integer;
begin
fhttpRequest := TIdHTTP.Create(nil);
fhttpRequest.HandleRedirects := True;//允许头转向
fhttpRequest.ReadTimeout := 5000;//请求超时设置
fhttpRequest.Request.ContentType := 'application/x-www-form-urlencoded';//设置内容类型为json
PostData := TStringStream.Create('');
PostData.Position := 0;//将流位置置为0
s:='';
for I := 0 to data.Count - 1 do begin
s:=s data[i] '
评论