procedure TForm1.Button1Click(Sender: TObject); var EncodedDataString: string; PostData: OleVariant; Headers: OleVariant; I: Integer; begin // First, create a URL encoded string of the data EncodedDataString := 'Name=' + HTTPEncode(Name.Text) + '&' + 'email=' + HttpEncode(email.Text) + '&' + 'address=' + HttpEncode(address.Text) + '&' + 'mailsubject=' + HttpEncode(mailsubject.Text) + '&' + 'text1=' + HttpEncode(text1.Text) + '&' + 'text2=' + HttpEncode(text2.Text) + '&' + 'text3=' + HttpEncode(text3.Text) ; // The PostData OleVariant needs to be an array of bytes as large // as the string (minus the NULL terminator) PostData := VarArrayCreate([0, Length(EncodedDataString) - 1], varByte); // Now, move the Ordinal value of the character into the PostData array for I := 1 to Length(EncodedDataString) do PostData[I-1] := Ord(EncodedDataString[I]); Headers := 'Content-Type: application/x-www-form-urlencoded' + #10#13; // Finally, we just Navigate to the URL. Note that you may have to modify // the path to your ASP page’s location. WebBrowser1.Navigate('http://127.0.0.1/post/send.asp', EmptyParam, EmptyParam, PostData, Headers); end;
end.
-----在D7提示错误: [Error] Unit1.pas(52): Undeclared identifier: 'VarArrayCreate' [Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'