MWDemo.vbs 4.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. '****************************特别说明****************************
  2. '* 1.使用Http方式连接到平台,请使用 server1.montnets.com:80
  3. '* 2.使用Http方式连接到服务器,必须使用所有以"Http"结尾的方法
  4. '****************************************************************
  5. ' On Error Resume Next '当程序出现意外错误时能继续执行
  6. Set myCom=Createobject("MWCom.clscom") '创建Com对象实例
  7. bTcpFlag=False
  8. 'bSendFlag=False
  9. bSendFlag=True
  10. 'bTcpFlag =True
  11. phones="13530504411,13304780001,13304780002,13304780003,13304780004,13304780005,13304780006,13304780007,13304780008,13304780009," _
  12. +"13304780010,13304780011,13304780012,13304780013,13304780014,13304780015,13304780016,13304780017,13304780018,13304780019," _
  13. +"13304780020,13304780021,13304780022,13304780023,13304780024,13304780025,13304780026,13304780027,13304780028,13304780029," _
  14. +"13304780030,13304780031,13304780032,13304780033,13304780034,13304780035,13304780036,13304780037,13304780038,13304780039," _
  15. +"13304780040,13304780041,13304780042,13304780043,13304780044,13304780045,13304780046,13304780047,13304780048,13304780049," _
  16. +"13304780050,13304780051,13304780052,13304780053,13304780054,13304780055,13304780056,13304780057,13304780058,13304780059," _
  17. +"13304780060,13304780061,13304780062,13304780063,13304780064,13304780065,13304780066,13304780067,13304780068,13304780069," _
  18. +"13304780070,13304780071,13304780072,13304780073,13304780074,13304780075,13304780076,13304780077,13304780078,13304780079," _
  19. +"13304780080,13304780081,13304780082,13304780083,13304780084,13304780085,13304780086,13304780087,13304780088,13304780089," _
  20. + "13304780090,13304780091,13304780092,13304780093,13304780094,13304780095,13304780096,13304780097,13304780098,13304780099"
  21. if bTcpFlag then
  22. 'clientsocket=myCom.MWConnect ("61.145.229.26",8018,"13811111111","123456") '连接短信平台
  23. 'clientsocket=myCom.MWConnect ("server1.montnets.com",8018,"13811111111","123456") '连接短信平台
  24. 'clientsocket=myCom.MWConnectSocks4Proxy("192.169.1.150",1080,"61.242.89.115",8018,"13600000***","******") '连接短信平台
  25. 'clientsocket=myCom.MWConnectSocks5Proxy("192.169.1.150",1080,"farlook","farlook","61.242.89.115",8018,"13600000***","******") '连接短信平台
  26. if clientsocket>0 then '连接成功
  27. if bSendFlag then
  28. 'sendret1=myCom.MWSendMsg("13534110346","恭喜发财,测试信息~~~, socket5 Com single") '发送单向信息
  29. 'sendret2=myCom.MWCsSendMsg("13534***346","恭喜发财,测试信息~~~",1) '发送客服信息
  30. sendret2=myCom.MWCsSendMsg(phones,"恭喜发财,测试信息,请不要发送出去。",100) '发送客服信息
  31. 'sendret3=myCom.MWVasSendMsg("13534***346","恭喜发财,测试信息~~~","121336", _
  32. ' "91600","00********","12145678",1) '发送增值信息
  33. end if
  34. Recvret=myCom.MWCsGetMsg() '读取客服信息
  35. ' Recvret=myCom.MWVasGetMsg() '读取增值信息
  36. 'If clientsocket>0 then
  37. ' reconn=myCom.MWReConnect() '重新连接
  38. 'else
  39. ' reconn=-1
  40. 'end if
  41. Readret=myCom.MWCsGetStatus() '读取发送状态报告
  42. myfee=myCom.MWQueryFee() '查帐号余额
  43. msgbox "发送单向信息结果" & sendret1
  44. 'msgbox "发送增值信息结果 & sendret3
  45. else
  46. msgbox "连接服务器失败,返回" & clientsocket
  47. end if
  48. else
  49. clientsocket=myCom.MWConnectHttp("server1.montnets.com",80,"13811111111","123456") '连接短信平台
  50. msgbox "连接成功" & clientsocket
  51. 'clientsocket=myCom.MWConnectHttp("61.145.229.26",80,"13811111111","123456") '连接短信平台
  52. 'clientsocket=myCom.MWConnectHttpProxy("192.169.1.150",808,"farlook","farlook","61.242.89.115",80,"13600000***","******") '连接短信平台
  53. if clientsocket>0 then '连接成功
  54. if bSendFlag then
  55. sendret2=myCom.MWCsSendMsgHttp(phones,"恭喜发财,测试信息~~~ http vbs",100) '发送客服信息
  56. msgbox "发送返回" & sendret2
  57. end if
  58. 'Recvret=myCom.MWCsGetMsgHttp() '读取客服信息
  59. 'If clientsocket>0 then
  60. ' reconn=myCom.MWReConnectHttp() '重新连接
  61. 'else
  62. ' reconn=-1
  63. 'end if
  64. 'Readret=myCom.MWCsGetStatusHttp() '读取发送状态报告
  65. 'myfee=myCom.MWQueryFeeHttp() '查帐号余额
  66. else
  67. msgbox "连接服务器失败,返回" & clientsocket
  68. end if
  69. end if
  70. if clientsocket>0 then
  71. myCom.MWDisConnect() '断开连接
  72. 'msgid=myCom.MWCsMsgID() '取得客服信息编号
  73. 'msgbox "发送客服信息结果" & sendret2
  74. 'msgbox "信息编号:" & msgid
  75. 'msgbox "连接句柄为:" & clientsocket
  76. 'msgbox "账户余额" & myfee
  77. 'msgbox Recvret & "个"
  78. for i=0 to Recvret-1 '显示所有的接收信息
  79. 'recmsg=myCom.MWGetRcvdMsg(i) '取得信息队列内容
  80. 'msgbox "第" & i+1 & "个用户信息:" & recmsg
  81. next
  82. 'msgbox "读取状态报告个数" & Readret & "个"
  83. for j=0 to Readret-1 '显示所有的状态报告
  84. 'statrep=myCom.MWGetStatRep(j) '取得状态报告队列内容
  85. 'msgbox "第" & j+1 & "个状态报告:" & statrep
  86. next
  87. end if