-
-
Auto.js get和post 案例
-
发表于: 2022-7-31 01:01 4578
-
<table><tr><td bgcolor=orange>本文所有教程及源码、软件仅为技术研究。不涉及计算机信息系统功能的删除、修改、增加、干扰,更不会影响计算机信息系统的正常运行。不得将代码用于非法用途,如侵立删!</td></tr></table>
Auto.js get和post 案例
操作环境
- win10
- nexus5x
- Auto.js 7.0.4
get 案例

简单GET请求
1 2 3 4 | console.show();var r = http.get("506K9s2c8@1M7q4)9K6b7g2)9J5c8W2)9J5c8Y4N6%4N6#2)9J5k6h3u0S2K9h3c8#2i4K6u0W2j5$3!0E0");log("code = " + r.statusCode);log("html = " + r.body.string()); |

回调形式的GET请求
1 2 3 4 5 6 7 8 9 | console.show();http.get("050K9s2c8@1M7q4)9K6b7g2)9J5c8W2)9J5c8Y4N6%4N6#2)9J5k6h3u0S2K9h3c8#2i4K6u0W2j5$3!0E0", {}, function(res, err){ if(err){ console.error(err); return; } log("code = " + res.statusCode); log("html = " + res.body.string());}); |


get 案例demo
1 2 3 4 5 6 7 8 9 | console.show();http.get("https://****/?uid=857fcfb50b474ef1cc7fa1b07e&ty=2", {}, function(res, err){ if(err){ console.error(err); return; } log("code = " + res.statusCode); log("html = " + res.body.string());}); |

post 案例

简单post
1 2 3 4 5 6 7 8 9 10 11 12 13 | var url = "ee7K9s2c8@1M7s2y4Q4x3@1q4Q4x3V1k6Q4x3V1k6D9L8$3N6A6L8W2)9J5k6i4c8S2L8$3u0S2L8#2)9J5k6h3y4G2L8g2)9J5c8X3#2W2L8h3u0W2M7W2)9J5c8X3I4G2k6$3W2F1i4K6u0W2K9X3S2@1L8h3H3`.";var username = username ;var password = password ;var res = http.post(url, { "TPL_username": username, "TPL_password": password});var html = res.body.string();if(html.contains("页面跳转中")){ toast("登录成功");}else{ toast("登录失败");} |
postJson
以JSON格式向目标Url发起POST请求
1 2 3 4 5 6 7 | var url = "31bK9s2c8@1M7q4)9K6b7g2)9J5c8W2)9J5c8Y4N6%4N6#2)9J5k6i4c8#2L8r3W2F1k6K6p5J5x3#2)9J5k6h3y4G2L8g2)9J5c8X3!0H3k6h3&6S2M7r3W2Q4x3V1k6S2M7r3V1`.";r = http.postJson(url, { key: "65458a5df537443b89b31f1c03202a80", info: "你好啊", userid: "1",});toastLog(r.body.string()); |

post 案例demo
1 2 3 4 5 6 7 8 9 10 11 12 13 | // 接口地址var url = "";var res = http.post(url, { "payid": payid, "password": password, "amount": amount, "remark": remark, "username": username, "password": password, "timestamp": timestamp });var html = res.body.string();log(html); |
资源下载
<table><tr><td bgcolor=orange>本文仅供学习交流使用,如侵立删!</td></tr></table>
赞赏
赞赏
雪币:
留言: