Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

You can only send text messages using VBS.

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces that you can only use VBS to send text messages, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let's take a look at it.

The code is as follows:

M = "xxxyyyyzzzz" 'mobile phone number

Pass = "12345678" 'login password

Msg = "Hello world" 'Fetion content

Const online = 1 'online

Const busy = 2 'busy

Const away = 3 'leave

Const hidden = 4 'stealth

Dim http

Set http = CreateObject ("Msxml2.XMLHTTP")

Http.open "POST", "http://f.10086.cn/im/login/inputpasssubmit1.action", False"

Http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

Http.send "m =" & m & "& pass=" & pass & "& loginstatus=" & hidden 'stealth landing

Wml = http.responseText

If InStr (wml, "password input error") Then

WScript.Echo "Sorry, the password was entered incorrectly, please re-enter it!"

WScript.Quit 'login failed, exit the program

End If

Http.open "POST", "http://f.10086.cn/im/user/sendMsgToMyselfs.action", False"

Http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

Http.send "msg=" & msg 'send text messages to your mobile phone

Wml = http.responseText

If InStr (wml, "sent successfully") Then WScript.Echo "sent successfully"

Http.open "GET", "http://f.10086.cn/im/index/logoutsubmit.action", False"

Http.send 'logout login

This is just an example. As for how to send text messages to others and Fetion, figure it out for yourself. I originally wanted to write a VbsFetion like PyFetion, but it doesn't make any sense to think about it, so it's better to install a Fetion PC client directly, so I don't bother, and students who like to toss around can continue.

The above program can be easily rewritten into other languages, such as C, C++, C #, Java, JavaScript, Python, Perl, Ruby, Lua, PHP. You can do a lot of interesting things with this interface, can't you?

VBS SMS message Fetion sending class (VBSFetion)

I originally intended to rewrite the VBS program in yesterday's "sending text messages with VBS (Fetion)" into PHP, but in order not to repeat the wheel, I Google it in advance and found that it has already been realized. For details, see PHP Fetion sending class (PHPFetion) v1.2 release. Well, now that someone has encapsulated it as a PHP class, I'll encapsulate a VBS class.

The code is as follows:

Class VBSFetion

Private [$mobile], [$password], http

'Author: Demon

'Website: http://demon.tw

Date: 2011-6-11

'initialize the event

Private Sub Class_Initialize

Set http = CreateObject ("Msxml2.XMLHTTP")

End Sub

'end the event

Private Sub Class_Terminate

Call Logout ()

Set http = Nothing

End Sub

'initialize the function

'mobile cell phone number

'password login password

Public Function Init (mobile, password)

[$mobile] = mobile

[$password] = password

Str = Login ()

If InStr (str, "password input error") Then

Init = False

Else

Init = True

End If

End Function

'send Fetion

'mobile the other party's cell phone number

'what is sent by message

Public Function SendMsg (mobile, message)

If message = "" Then Exit Function

If mobile = [$mobile] Then

Send = ToMyself (message)

Else

Uid = GetUid (mobile)

If uid-1 Then Send = ToUid (uid, message, False)

End If

End Function

'send a text message

'mobile the other party's cell phone number

'' message sends content

Public Function SendShortMsg (mobile, message)

If message = "" Then Exit Function

If mobile = [$mobile] Then

Send = ToMyself (message)

Else

Uid = GetUid (mobile)

If uid-1 Then Send = ToUid (uid, message, True)

End If

End Function

'Log in

Private Function Login ()

Url = "/ im/login/inputpasssubmit1.action"

Data = "m =" & [$mobile] & "& pass=" & [$password] & "& loginstatus=4"

Login = Post (url, data)

End Function

'Log out

Private Function Logout ()

Url = "/ im/index/logoutsubmit.action"

Logout = Post (url, "")

End Function

Send yourself Fetion

Private Function ToMyself (message)

Url = "/ im/user/sendMsgToMyselfs.action"

Message = "msg=" & message

ToMyself = Post (url, message)

End Function

'send Fetion (SMS) to your friends

'uid Fetion ID

'message Fetion (SMS) content

Isshort True is SMS and False is Fetion

Private Function ToUid (uid, message, isshort)

If isshort Then

Url = "/ im/chat/sendShortMsg.action?touserid=" & uid

Data = "msg=" & message

Else

Url = "/ im/chat/sendMsg.action?touserid=" & uid

Data = "msg=" & message

End If

ToUid = Post (url, data)

End Function

'get Fetion ID

'mobile cell phone number

Private Function GetUid (mobile)

Url = "/ im/index/searchOtherInfoList.action"

Data = "searchText=" & mobile

Str = Post (url, data)

Set re = New RegExp

Re.Pattern = "/ toinputMsg\ .action\? touserid= (\ d +)"

If re.Test (str) Then

Set ms = re.Execute (str)

GetUid = ms.Item (0) .Subscript (0)

Else

GetUid =-1

End If

End Function

'send a HTTP POST request

Private Function Post (url, data)

Url = "http://f.10086.cn" & url"

Http.open "POST", url, False

Http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

Http.send data

Post = http.responseText

End Function

End Class

Sample program:

'initial object

Set fetion = New VBSFetion

'Log in to Fetion

If fetion.Init ("11122223333", "123456") Then

'send Fetion

Fetion.SendMsg "44455556666", "Hello world"

'send a text message

Fetion.SendShortMsg "77788889999", "Hello world"

End If

Thank you for reading this article carefully. I hope the article "sending text messages only using VBS" shared by the editor will be helpful to everyone. At the same time, I also hope you can support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report