DELPHI传递HTTP参数的格式怎么写啊,

sunhonglei2004 2009-09-22 09:33:46

begin
with adoquery1 do
begin
close;
sql.clear;
sql.add('select top 1 id,mobile,serviceCode,linkid,spNum,moMsg from tb_118 where type=0 order by id');
open;
a:= adoquery1.recordcount;
id:=adoquery1.fieldbyname('id').asinteger;
mobile:= adoquery1.fieldbyname('mobile').asstring;
servicecode:= adoquery1.fieldbyname('serviceCode').asstring;
linkid:= adoquery1.fieldbyname('linkid').asstring;
spnum:= adoquery1.fieldbyname('spNum').asstring;
momsg:= adoquery1.fieldbyname('moMsg').asstring;

Memo2.Lines.Text:= idhttp1.get('http://localhost/cxxt_sms/get/get1.asp?mobile=:mobile&servicecode=:servicecode&linkid=:linkid&spnum=:spnum&momsg=:momsg');


最后那一个代码,是传递HTTP参数,格式是这样写吗,我这不能成功,望高手指教
...全文
248 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
wintergoes 2009-09-22
  • 打赏
  • 举报
回复
var
toUrl: string;
begin
toUrl := 'http://localhost/cxxt_sms/get/get1.asp?mobile='+mobile+'&servicecode='+servicecode+'&linkid='+linkid+'&spnum='+spnum;
idhttp1.get(toUrl )¡­
end;

在idhttp1.get设个断点,然后把toUrl的值取出来放到IE里试试
sunhonglei2004 2009-09-22
  • 打赏
  • 举报
回复
已经试过了,没有问题的
sunhonglei2004 2009-09-22
  • 打赏
  • 举报
回复
已经试过了,没有问题的
wintergoes 2009-09-22
  • 打赏
  • 举报
回复
你先在IE里打开这个地址试试
sunhonglei2004 2009-09-22
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 dd_zhouqian 的回复:]
Delphi(Pascal) codevar Ts:TStringStream;
Ts:=TStringStream.Create('');
idhttp1.get('http://localhost/cxxt_sms/get/get1.asp?mobile='+mobile+'&servicecode='+servicecode+'&linkid='+linkid+'&spnum='+spnum¡­
[/Quote]

我不知道您这种是否正确,但是我用这种方法一运行,会提示http 1.1 400 bad request错误
sunhonglei2004 2009-09-22
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 wintergoes 的回复:]
把参数里的冒号都去掉
另外=号后面的值不是mobile这样的吧,应该是138XXXXX这样的吧
[/Quote]

我是从数据库当中取到各值,再把值赋给各参数,传递出去,不可能传递具体的数据的
wintergoes 2009-09-22
  • 打赏
  • 举报
回复
把参数里的冒号都去掉
另外=号后面的值不是mobile这样的吧,应该是138XXXXX这样的吧
dd_zhouqian 2009-09-22
  • 打赏
  • 举报
回复

var Ts:TStringStream;
Ts:=TStringStream.Create('');
idhttp1.get('http://localhost/cxxt_sms/get/get1.asp?mobile='+mobile+'&servicecode='+servicecode+'&linkid='+linkid+'&spnum='+spnum+'&momsg='+momsg,Ts);
Memo2.Lines.Text:=Ts.DataString;
sunhonglei2004 2009-09-22
  • 打赏
  • 举报
回复
高手,不行啊
Memo2.Lines.Text:= idhttp1.get('http://localhost/cxxt_sms/get/get1.asp?mobile=:mobile&servicecode=:servicecode&linkid=:linkid&spnum=:spnum&momsg=:momsg');

我在这用这个代码把参数传递上去之后,接收到的直接还是:mobile 而不是这个参数所代表的内容,
JPEXE 2009-09-22
  • 打赏
  • 举报
回复
格式没错啊,那些冒号(:)是参数中要求的还是你自己加上去的?如果参数中没有冒号就去掉.

1,593

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧