5,388
社区成员
发帖
与我相关
我的任务
分享
str_url:='http://211.155.25.158:8090/Submit.asp?cmp_name=public&user_name=1231&user_pass=123456&rec_mobile=13712536345&msg_content=各位。你们好!';
ShellExecute(Handle,'open','explorer.exe',PChar(str_url),nil, SW_SHOWNORMAL);
function HTTPEncode(const AStr: String): String;
// The NoConversion set contains characters as specificed in RFC 1738 and
// should not be modified unless the standard changes.
const
NoConversion = ['A'..'Z','a'..'z','*','@','.','_','-',
'0'..'9','$','!','''','(',')'];
var
Sp, Rp: PChar;
begin
SetLength(Result, Length(AStr) * 3);
Sp := PChar(AStr);
Rp := PChar(Result);
while Sp^ <> #0 do
begin
if Sp^ in NoConversion then
Rp^ := Sp^
else
if Sp^ = ' ' then
Rp^ := '+'
else
begin
FormatBuf(Rp^, 3, '%%%.2x', 6, [Ord(Sp^)]);
Inc(Rp,2);
end;
Inc(Rp);
Inc(Sp);
end;
SetLength(Result, Rp - PChar(Result));
end;
function URLEncode(const S: string):string;
var
Idx: Integer; // loops thru characters in string
begin
Result := '';
for Idx := 1 to Length(S) do
begin
case S[Idx] of
'A'..'Z', 'a'..'z', '0'..'9', '-', '_', '.':
Result := Result + S[Idx];
' ':
{ if InQueryString then
Result := Result + '+'
else }
Result := Result + '%20';
else
Result := Result + '%' + SysUtils.IntToHex(Ord(S[Idx]), 2);
end;
end;
end;
//转换完成后的URL变为
//http://211.155.25.158:8090/Submit.asp?cmp_name=public&user_name=1231&user_pass=123456&rec_mobile=13712536345&msg_content=%B8%F7%CE%BB%A1%A3%C4%E3%C3%C7%BA%C3%A3%A1
ShellExecute(Handle,'open',PChar(str_url),nil,nil, SW_SHOWNORMAL);