javascript - 用于注册到第三方网站的脚本

标签 javascript php curl autohotkey

我工作的一部分是在第三方游戏网站上注册几个新用户。 我使用 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/

相关文章:

curl - Elasticsearch查询中的排除给出了无法解析搜索源的信息。预期的字段名称,但获得了[START_OBJECT]

python - 在 post 请求中发送多个文件

javascript - THREE.js bufferGeometry的Color和position属性使用不同的顶点,比较困难

javascript - MeanJS - 将 ArticleID 添加到 Comment Mongo 集合

PHP: session 仅在刷新页面后才起作用

php - 如何在 godaddy vps 服务器中找到 FFMPEG 文件路径?

php - Zend_Search_Lucene 的替代品?

curl 错误 "Expire in 1 ms for 1 (transfer 0x...)"

javascript - 如何使用 jaggery 超过 64K 限制

javascript - 响应式卡片布局 CSS 设计未修复