上一篇主題 :: 下一篇主題 |
發表人 |
內容 |
ufochen
註冊時間: 2003-09-17 文章: 166
第 1 樓
|
發表於: 星期日 三月 30, 2014 12:09 pm 文章主題: 用程式發送簡訊的問題 ? |
|
|
用程式大量傳送簡訊碰到問題 , 因為簡訊公司提供的範例程式無群組發送的功能 , 要大量傳送只能用迴圈的方式 , 於是我用 scan ... endscan 的方式想把整個資料表的電話全部傳送,
但實作結果 , 每次程式都只傳資料表的最後一個電話 , 而不是整個資料表的電話 !
程式如下 :
SendID = Rtrim(Thisform.TxtID.Value) && 帳號
SendPrd = Rtrim(Thisform.TxtPrd.Value) && 密碼
SendText = Rtrim(Thisform.editMsg.Value) && 簡訊內容
ieSend = Createobject("InternetExplorer.Application")
Select sendMsg
nSend = 0
Scan For Left(Rtrim(Tel1),2) = "09"
SendTel = Rtrim(Tel1)
SendURL = "http://api.twsms.com/smsSend.php?" + ;
"username=" + SendID ;
+ "&password=" + SendPrd ;
+ "&mobile=" + SendTel ;
+ "&message=" + SendText
ieSend.Navigate(SendURL)
nSend = nSend + 1
Replace SendMsgEd With .T.
Endscan
=Messagebox("訊息傳送完成 , 共發送 " + Alltrim(Str(nSend)) + " 封簡訊")
請問諸位先進 , 如何解決這個問題 ? |
|
回頂端 |
|
 |
ufochen
註冊時間: 2003-09-17 文章: 166
第 2 樓
|
發表於: 星期日 三月 30, 2014 12:18 pm 文章主題: |
|
|
把一樓的程式碼改變成以下 , 可以正確的大量發送簡訊 , 但會出現錯誤 !
SendID = Rtrim(Thisform.TxtID.Value)
SendPrd = Rtrim(Thisform.TxtPrd.Value)
SendText = Rtrim(Thisform.editMsg.Value)
ieSend = Createobject("InternetExplorer.Application")
Select sendMsg
nSend = 0
Scan For isselected And Left(Rtrim(Tel1),2) = "09"
SendTel = Rtrim(Tel1)
SendURL = "http://api.twsms.com/smsSend.php?" + ;
"username=" + SendID ;
+ "&password=" + SendPrd ;
+ "&mobile=" + SendTel ;
+ "&message=" + SendText
ieSend.Navigate(SendURL)
**** 加上以下兩行 可以正確發送 *********************
Do While ieSend.BUSY Or ieSend.READYSTATE <> 4
Enddo && ***** 這一行出現錯誤
nSend = nSend + 1
Replace SendMsgEd With .T.
Endscan
錯誤訊息 : OLE error 0x80004005:Unspecified error. |
|
回頂端 |
|
 |
lygcw9603
註冊時間: 2011-12-25 文章: 130
第 3 樓
|
發表於: 星期日 三月 30, 2014 12:29 pm 文章主題: |
|
|
Do While ieSend.BUSY Or ieSend.READYSTATE <> 4
Inkey(1) &&延时1秒
Enddo
试试 |
|
回頂端 |
|
 |
ufochen
註冊時間: 2003-09-17 文章: 166
第 4 樓
|
發表於: 星期日 三月 30, 2014 7:15 pm 文章主題: |
|
|
lygcw9603 寫到: | Do While ieSend.BUSY Or ieSend.READYSTATE <> 4
Inkey(1) &&延时1秒
Enddo
试试 |
Enddo 這一行還是出現錯誤訊息如下 :
the object invoked has disconnected from its clients |
|
回頂端 |
|
 |
nelsonchuang
註冊時間: 2003-09-04 文章: 563 來自: 臺灣
第 5 樓
|
發表於: 星期日 三月 30, 2014 9:27 pm 文章主題: |
|
|
改用timer如何? _________________ 大家好,請多指教 |
|
回頂端 |
|
 |
ckp6250
註冊時間: 2004-07-30 文章: 1645
第 6 樓
|
發表於: 星期日 三月 30, 2014 10:12 pm 文章主題: |
|
|
個人覺得
發送簡訊用Createobject("InternetExplorer.Application")大量去發簡訊
不是很好的方法
該簡訊公司,沒有提供 api 嗎 ? |
|
回頂端 |
|
 |
ufochen
註冊時間: 2003-09-17 文章: 166
第 7 樓
|
發表於: 星期一 三月 31, 2014 3:37 am 文章主題: |
|
|
ckp6250 寫到: | 個人覺得
發送簡訊用Createobject("InternetExplorer.Application")大量去發簡訊
不是很好的方法
該簡訊公司,沒有提供 api 嗎 ? |
該公司網址是: https://www.twsms.com/index.php
該公司有提供各種程式的範例,其中VB.net 的範例如下
mports System.IO
Imports System.Net
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim URL As String = ""
URL = "username=" & TextBox1.Text & "&password=" & TextBox2.Text & "&mobile=" & TextBox3.Text & "&message=" & RichTextBox1.Text
Dim client As WebClient = New WebClient()
Dim data As Stream = client.OpenRead("http://api.twsms.com/smsSend.php?" & URL)
Dim reader As StreamReader = New StreamReader(data)
Dim resp As String = reader.ReadToEnd()
MessageBox.Show("發送完成:" & vbCrLf & resp)
End Sub
End Class
可否幫我改成VFP語法! 謝謝 ! |
|
回頂端 |
|
 |
ckp6250
註冊時間: 2004-07-30 文章: 1645
第 8 樓
|
發表於: 星期一 三月 31, 2014 9:02 am 文章主題: |
|
|
ufochen 寫到: |
Dim data As Stream = client.OpenRead("http://api.twsms.com/smsSend.php?" & URL)
|
換湯不換藥呀! |
|
回頂端 |
|
 |
215001
註冊時間: 2003-06-11 文章: 393
第 9 樓
|
發表於: 星期一 三月 31, 2014 10:11 am 文章主題: |
|
|
我都用以下方式
代碼: |
xobj = createObject("Msxml2.XMLHTTP")
xmsg=trim(簡訊內容) && 中英文最多70字
xobj.open("GET", "http://211.78.23.230/send_sms.php?username=" + ALLTRIM(帳號) + "&password=" + ALLTRIM(密碼) + "&type=now&encoding=big5&mobile=" + trim(行動電話) + "&message=" + xmsg + "&vldtime=86400", .F. )
xobj.send()
RELEASE xobj
|
|
|
回頂端 |
|
 |
|