You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Flutter/Dart中对指定URL执行GET请求?

如何执行该GET请求及处理请求参数

一、执行GET请求的常用方法

  • 浏览器直接访问:将完整URL复制到浏览器地址栏,回车即可发起请求,浏览器会自动处理参数的拼接与传递。
  • 命令行工具(curl):在终端执行以下命令:
curl "http://192.168.1.4:8080/HongLeong/RUN_HYPERLINK.do?_dc=1658998611394&hyper_classid=25510&hyper_id=2&hyper_mad_key=0&refer_classid=25510&refer_id=2&refer_mad_key=32835&table_id=25510&is_ctrl_pressed=0&isSearchParamForm=0&load_UserParameterInContext=1&ViewType=RUN_HYPERLINK&gui_open_popup=1&cell_context_id=537621&id_Window=5&activeWindowId=mw_5&noOrigUserDate=true&LocalDate=20220728&LocalTime=16565100&TimeZone=Asia/Shanghai&UserDate=0&UserTime=0&server_name=OPRISK_DATACOLLECTOR&key_id_list=536875&id_Desktop=100269&operation_key=1000009&operation_sub_num=-1&is_json=1&is_popup=0&is_search_window=0&ccsfw_conf_by_user=0&is_batch=0&reset_context=0&previousToken=1658998589864&historyToken=1658998611391&historyUrl=1"
  • Python代码实现:使用requests库发起请求(需先安装requests:pip install requests):
import requests

url = "http://192.168.1.4:8080/HongLeong/RUN_HYPERLINK.do"
params = {
    "_dc": "1658998611394",
    "hyper_classid": "25510",
    "hyper_id": "2",
    "hyper_mad_key": "0",
    "refer_classid": "25510",
    "refer_id": "2",
    "refer_mad_key": "32835",
    "table_id": "25510",
    "is_ctrl_pressed": "0",
    "isSearchParamForm": "0",
    "load_UserParameterInContext": "1",
    "ViewType": "RUN_HYPERLINK",
    "gui_open_popup": "1",
    "cell_context_id": "537621",
    "id_Window": "5",
    "activeWindowId": "mw_5",
    "noOrigUserDate": "true",
    "LocalDate": "20220728",
    "LocalTime": "16565100",
    "TimeZone": "Asia/Shanghai",
    "UserDate": "0",
    "UserTime": "0",
    "server_name": "OPRISK_DATACOLLECTOR",
    "key_id_list": "536875",
    "id_Desktop": "100269",
    "operation_key": "1000009",
    "operation_sub_num": "-1",
    "is_json": "1",
    "is_popup": "0",
    "is_search_window": "0",
    "ccsfw_conf_by_user": "0",
    "is_batch": "0",
    "reset_context": "0",
    "previousToken": "1658998589864",
    "historyToken": "1658998611391",
    "historyUrl": "1"
}

response = requests.get(url, params=params)
print(response.text)

二、请求参数处理说明

  • GET请求的参数会自动拼接在URL的?之后,用&分隔,无需手动拼接,工具或代码会自动处理。
  • 动态参数注意:_dc、previousToken、historyToken这类参数是动态生成的时间戳或会话令牌,存在过期可能,直接复用原URL的参数大概率会请求失败。遇到失败时,需要从当前有效会话中获取最新的令牌或时间戳。
  • 静态参数说明:hyper_classid、server_name、ViewType等属于业务固定标识,无需修改,直接保留即可。
  • 参数调试技巧:如果不确定哪些参数是必填项,可以先保留核心业务参数(如ViewType、hyper_classid、server_name),再逐步添加其他参数,观察请求是否成功,以此排查出必填参数集合。

内容的提问来源于stack exchange,提问作者JoshuaaMarkk

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.24 10:18:33