VB登录CRM系统(二) – 千丝海阁

首页 » VB » VB登录CRM系统(二)

VB登录CRM系统(二)

1937 0

通过sniffer得到CRM的认证文件为verifyuser.asp,并且成功后自动转向window.asp,事实上window.asp是个frame的文件,

包涵了三个页面,我们只需要它的 main_frame,也就是desktop.asp

strFormData = "Loginname=" + Text1.Text + "&Password=" + Text2.Text
Inet1.Execute "http://XXX/crm/verifyuser.asp", "Post", strFormData, "Content-Type: application/x-www-form-urlencoded "
Do Until Inet1.StillExecuting = False
DoEvents
Loop
WebBrowser1.Navigate "http://XXX/crm/desktop.asp"

这样简单的登录做好了,接下来要做的是自动回帖.用户的CRM是一个考勤BBS,主帖子以一周日期为名,要求自动能在当前日期的帖子中点击回复按钮即可,回复内容为空也行.

这里通过documentcomplete来判断是否下载完毕,并把内容存在Richtextbox1中

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
RichTextBox1 = WebBrowser1.Document.body.innerHTML

以下为如何获取准确的帖子id

t = Format(Now, "mm.dd")
i = InStr(1, RichTextBox1.Text, t)
If RichTextBox1.Text = "" Then
SkinLabel3.Caption = "Get Null.(cause Manual)"
Exit Sub
End If
RichTextBox1 = Mid(RichTextBox1.Text, i - 91)
If Left(RichTextBox1.Text, 4) <> "view" Then
SkinLabel3.Caption = "Format error.(cause code update)!"
Exit Sub
End If
'get board_id&reply_id
RichTextBox1 = Mid(RichTextBox1.Text, 7)
zong_id = Left(RichTextBox1.Text, 15)
RichTextBox1 = Mid(RichTextBox1.Text, 19)
tiezi_id = Left(RichTextBox1.Text, 10)
'MsgBox tiezi_id
WebBrowser1.Navigate "http://XXX/crm/Bbs/Reply.asp?UID=&ColumnTypeID=" & zong_id & "&ParentTypeID=" & tiezi_id & "&ReplyTypeID=" & tiezi_id & "&Quote="

最后用sniffer获得回帖submit的数据,用inet.excute给服务器.

strFormData = "Subject=RE%3A" & t & "%" & d & "&SerialNumber=OA-00150-2008-12-17.5051538&szCoBBSCusObjectTypeID=OA-00150-2008"
strFormData = strFormData + "-12-17.6814801&Redirect=0&IsPopOutOnError=No&Style=" & zong_id & "&ParentTypeID=" & tiezi_id & "&DataType=2&HideDataType=2&font=%BF%C9%D1%A1%D4%F1"
strFormData = strFormData + "&size=%BF%C9%D1%A1%D4%F1&color=%BF%C9%D1%A1%D4%F1&TextBox_SymbolsMenu=%BF%C9%D1%A1%D4%F1&Description=&Emotion=2&WordCount=0&CusReportCount=0"
Inet1.Execute "http://XXX/crm/Bbs/AddExe.asp", "Post", strFormData, "Content-Type: application/x-www-form-urlencoded "

至此,通讯部分已完成,剩下的就是按时间自动回帖,任务栏隐藏到托盘,以及用skinactive.ocx美化VB界面

******************************************************************************

PS:由于直接paste造成了中文乱码,大多注释部分没帖,
VB自动登录CRM

文章评分1次,平均分5.0

本文原始地址:https://www.tiandiyoyo.com/2008/12/vb%e7%99%bb%e5%bd%95crm%e7%b3%bb%e7%bb%9f%e4%ba%8c/
本站所有文章,除了特别注明外,均为本站原创,转载请注明出处来自www.tiandiyoyo.com

您可能还会对以下文章感兴趣:

评论前先开启评论开关: