台固的簡訊發送範例如何改寫成delphi |
答題得分者是:Clarinet
|
thomas0728
中階會員 發表:112 回覆:260 積分:89 註冊:2002-03-12 發送簡訊給我 |
各位大大好:
以下是台固的簡訊發送範例,,他是利用 http 協定中的 GET Method 來發送簡訊,範例是用 asp 寫的,有人知道如何改成 DELPHI 或用那一個元件,該如何做
<% smsUrl="http://sms1.anet.net.tw/onlinesend.jsp?" set xmlHTTP=Server.CreateObject("Microsoft.XMLHTTP") smsArgs="deptid=006" smsArgs=smsArgs&"&username=IIDD" smsArgs=smsArgs&"&password=xxxx" smsArgs=smsArgs&"&dstaddr=0930123456" smsArgs=smsArgs&"&encoding=BIG5" smsArgs=smsArgs&"&smbody="Server.URLEncode("簡訊") xmlHTTP.open "Get",smsURL&smsArgs,False xmlHTTP.setRequestHeader"Content-Type","application/x-www-form-urlencoded" xmlHTTP.send XMLStr=xmlHTTP.ResponseText if instr(XMLStr,"statuscode=0")>0 then Response.write xmlstr response.write "--->ok " else Response.write xmlstr response.write "--->dead " endif set xmlHTTP=nothing response.end %>謝謝 如果愛情也有味覺 那麼 有沒有ㄧ種愛 微微泛酸 不太苦澀 有點甜密 嚐起來的滋味讓人想起幸福 Thomas Chiou
------
Thomas Chiou |
Stallion
版主 發表:52 回覆:1600 積分:1995 註冊:2004-09-15 發送簡訊給我 |
|
Clarinet
高階會員 發表:9 回覆:97 積分:126 註冊:2002-05-08 發送簡訊給我 |
如下:有些地方省略了,若不懂再提 [code]
var
IdHTTPTmp :TIdHTTP;
ResponseList :TStringList; begin SrcAddr :=fSrcAddr;
//必
URLStr :=SendAddr;
URLStr :=URLStr Format('deptid=%s', [fDeptID]);
URLStr :=URLStr Format('&username=%s', [fUserName]);
URLStr :=URLStr Format('&password=%s', [fPassWord[cbPWD.ItemIndex]]);
URLStr :=URLStr Format('&srcaddr=%s', [SrcAddr]);
URLStr :=URLStr Format('&dstaddr=%s', [DstAddr]);
URLStr :=URLStr Format('&smbody=%s', [EncodeURLText(smBody)]);
//選
if dlvTime <>0 then //(YYYY-MM-DD hh24:mm:ss),不填內定值為立即發送
URLStr :=URLStr Format('&dlvtime=%s', [EncodeURLText(FormatDateTime('YYYY-MM-DD hh:mm:ss', dlvTime))]); //(ASCII/BIG5/PASCII/PBIG5),不填內定值為 BIG5
//smBodyWide :=smBody;
smBodyLen :=Length(smBody);
smBodyWideLen :=Length(smBodyWide);
if smBodyLen =smBodyWideLen then
begin
if BodyPopUp then
URLStr :=URLStr '&encoding=PASCII'
else
URLStr :=URLStr '&encoding=ASCII';
end
else if BodyPopUp then
URLStr :=URLStr '&encoding=PBIG5'; if vldTime >0 then //不填內定值為各SMSC之有效期限的預設值為一天86400秒
URLStr :=URLStr Format('&vldtime=%d', [vldTime]); if ReplyAddr <>'' then
begin
//if ResponseWeb[Length(ResponseWeb)] <>'''' then ResponseWeb :=ResponseWeb '''';
//if ResponseWeb[1] <>'''' then ResponseWeb :='''' ResponseWeb;
URLStr :=URLStr Format('&response=%s', [EncodeURLtext(ReplyAddr)]);
end;//end if ReplyAddr <>'' //送出後接收
ResponseList.Text :=IdHTTPTmp.Get(URLStr); //再去解ResponseList.Text的內容 [code] GPS(全球衛星定位系統)
http://www.allgps.com
------
GPS(全球衛星定位系統) http://www.allgps.com |
thomas0728
中階會員 發表:112 回覆:260 積分:89 註冊:2002-03-12 發送簡訊給我 |
|
thomas0728
中階會員 發表:112 回覆:260 積分:89 註冊:2002-03-12 發送簡訊給我 |
|
Clarinet
高階會員 發表:9 回覆:97 積分:126 註冊:2002-05-08 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |