脚本注册到第三方网站

时间:2015-04-11 06:26:12

标签: javascript php curl autohotkey

我的工作的一部分是将几个新用户注册到第三方游戏网站。 我使用curl使用ahk编写了一个脚本,它打开浏览器并循环填写注册表单并提交,但是网站对此不满意,因为它有时会超时或抱怨在短时间内过于频繁地登录。

我正在寻找重做脚本而不必打开浏览器,我不知道该使用什么,php与curl,JavaScript?

任何人都有任何好的建议和参考?我需要一些轻松快捷的东西。非常感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

我最近发了一篇关于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!