找回密码
 加入
搜索
查看: 3176|回复: 0

[网络通信] 飞信中的GlbalConnect问题

[复制链接]
发表于 2012-7-22 22:01:25 | 显示全部楼层 |阅读模式
#include <ButtonConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#include <WinHttp_GetRespond.au3>

#include <array.au3>

$MyOpen=_WinHttpOpen()

Global $GlbalConnect

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Form1", 337, 201,-1, -1)

$Input1 = GUICtrlCreateInput("", 24, 24, 121, 21)

$Input2 = GUICtrlCreateInput("", 24, 64, 121, 21)

$Input3 = GUICtrlCreateInput("", 24, 96, 121, 21)

$Pic1 = GUICtrlCreatePic("", 168, 80, 86, 28)

$Button1 = GUICtrlCreateButton("重新获取", 184, 128, 75, 25)

$Button2 = GUICtrlCreateButton("登录", 24, 128, 75, 25)

GUISetState(@SW_SHOW)

 

Global $Ccpsession,$webim_sessionid,$webim_usersid,$webim_userstatus,$webim_login_username

 

$rContext=_WinHTTP_GetRespond($MyOpen,"https://webim.feixin.10086.cn/",4 + 64 + 2,50000,"","webim_login_status=0")

If @error Then MsgBox(0,@error,"出错了")

 

$GlbalConnect = $rContext[7]

_Get_Code()

 

 

#EndRegion ### END Koda GUI section ###

 

While 1

        $nMsg = GUIGetMsg()

        Switch $nMsg

                Case $GUI_EVENT_CLOSE

                        _WinHttpCloseHandle($MyOpen)

                        Exit

                Case $Button1

                        _Get_Code()

                Case $Button2

                        _Login()

        EndSwitch

WEnd

 

Func _Get_Code()

        $rContext=_WinHTTP_GetRespond($MyOpen,$GlbalConnect&"https://webim.feixin.10086.cn/WebIM/GetPicCode.aspx?Type=ccpsession&0.2916220274839712",4 + 64 + 2 + 128,50000,"","webim_login_status=0; IsCookiesEnable=true")

;~ MsgBox(0,$rContext[3],$rContext[6])

        If @error Then Return MsgBox(0,@error,"出错了")

        $Ccpsession=StringRegExpReplace($rContext[3],"(ccpsession=.*?;).*","$1")

        $CodeFile = FileOpen(@ScriptDir & "\code.jpg",10)

        FileWrite($CodeFile,Binary($rContext[0]))

        FileClose($CodeFile)

        GUICtrlSetImage($Pic1,@ScriptDir & "\code.jpg")

;~      MsgBox(0,"",$Ccpsession)

EndFunc

 

Func _Login()

        $Context = 'UserName='&GUICtrlRead($Input1)&'&Pwd='&GUICtrlRead($Input2)&'&Ccp='&GUICtrlRead($Input3)&'&OnlineStatus=400'

;~      MsgBox(0,"提交内容为",$Context)

        $webim_login_username = 'webim_login_username='&GUICtrlRead($Input1)

        $rContext=_WinHTTP_GetRespond($MyOpen,$GlbalConnect&"https://webim.feixin.10086.cn/WebIM/Login.aspx",1 + 4 + 64 + 2 + 128,50000,$Context,"webim_login_status=0; IsCookiesEnable=true; "&$Ccpsession,"Content-Type: application/x-www-form-urlencoded")

        If @error Then Return MsgBox(0,@error,"出错了")

;~      MsgBox(0,"Header:",$rContext[6])

        MsgBox(0,"rc 200 的话就登录成功了!!:",BinaryToString($rContext[0],4))

        $Cookies = StringRegExp($rContext[3],'(webim_sessionid=.*?;).*\s(webim_usersid=.*?;).*\s(webim_userstatus=.*?;)',3)

;~      _ArrayDisplay($Cookies)

        If IsArray($Cookies) Then

                $webim_sessionid = $Cookies[0]

                $webim_usersid = $Cookies[1]

                $webim_userstatus = $Cookies[2]

        EndIf

        ;---后续操作我暂时没时间研究。

;~      'webim_login_status=0; IsCookiesEnable=true; ccpsession=30c7b9ae-6fbc-45ec-9b6d-d357ccd813de; webim_sessionid=238506531p171-27aa42b3-9d8f-49c5-87e3-a6e437284708; webim_usersid=736792141; webim_userstatus=400; webim_login_username=13417050980’

;~      $rContext=_WinHTTP_GetRespond($MyOpen,$GlbalConnect&"http://webim.feixin.10086.cn/main.aspx", 4 + 128 + 2 + 256,50000,"","webim_login_status=0; IsCookiesEnable=true; "&$Ccpsession &' '& $webim_sessionid &' '& $webim_usersid &' '& $webim_userstatus &' '& $webim_login_username)

;~      If @error Then Return MsgBox(0,@error,"出错了")

;~      MsgBox(0,"Header:",$rContext[6])

;~      MsgBox(0,"内容",BinaryToString($rContext[0],4))

;~      FileWrite(@ScriptDir &"\webim.html",Binary($rContext[0]))

EndFunc
那个飞信有例子中
$rContext=_WinHTTP_GetRespond($MyOpen,$GlbalConnect&"https://webim.feixin.10086.cn/WebIM/Login.aspx",1 + 4 + 64 + 2 + 128,50000,$Context,"webim_login_status=0; IsCookiesEnable=true; "&$Ccpsession,"Content-Type: application/x-www-form-urlencoded")里边的参数
$GlbalConnect&"https://webim.feixin.10086.cn/WebIM/Login.aspx"

$GlbalConnect 是什么呀,那个地方不是填网址么,请大家给小弟指个路吧,应该学哪方面的知识,
新手刚学习,这种问题莫怪,谢谢~

顺便问下,有没有学习交流群呀
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-27 02:33 , Processed in 0.070364 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表