我工作的一部分是在第三方游戏网站上注册几个新用户。 我使用 ahk 使用curl 编写了一个脚本,它打开浏览器并循环填写注册表并提交,但是该网站对此不满意,因为它有时会超时或提示在短时间内登录过于频繁。
我希望在不打开浏览器的情况下重做脚本,但我不知道该使用什么,带有curl的php,还是JavaScript?
大家有什么好的建议和引用吗?我需要一些轻便快捷的东西。非常感谢任何帮助。
最佳答案
我最近发表了一篇关于 WinHttpRequest COM 的文章,并解释了如何使用它进行登录:How to do logins using the WinHttpRequest COM?
如果您对目标站点进行逆向工程,您可以更改提供的代码以将注册所需的数据发送到服务器。
它可能看起来有点像这样:
;Prepare our WinHttpRequest object
HttpObj := ComObjCreate("WinHttp.WinHttpRequest.5.1")
;HttpObj.SetProxy(2,"localhost:8888") ;Send data through Fiddler (for debugging)
HttpObj.SetTimeouts(6000,6000,6000,6000) ;Set timeouts to 6 seconds
;HttpObj.Option(6) := False ;disable location-header rediects
;Set our URLs
registrationURL := "http://yoursite/registerOrWhatever/"
;Set our registration data
username := "Samah"
email := "myEmail@foo.bar"
password := "mySecretPassword"
acceptTOS := 1
receiveNewsLetter := 0
registrationBody := "username=" username "&email=" email "&repeatEmail=" email "&password=" password "&repeatPassword=" password "&TOSagree=" acceptTOS "&weeklyNewsLetter=" receiveNewsLetter
HttpObj.Open("POST",registrationURL)
HttpObj.SetRequestHeader("Content-Type","application/x-www-form-urlencoded")
HttpObj.Send(registrationBody)
If (HttpObj.status == 200 && InStr(HttpObj.ResponseText,"You will shortly receive an email with an activation link."))
MsgBox, User successfully registered.
Else
MsgBox, The registration failed!
关于javascript - 用于注册到第三方网站的脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29574855/