简体   繁体   English

桌面快捷方式的HTTP POST?

[英]HTTP POST from desktop shortcut?

I've got a wireless router with the Tomato custom firmware on it. 我有一个带有Tomato自定义固件的无线路由器。 There are a number of actions I'd like to perform from simple desktop shortcuts, such as turning off the wireless or running a command for checking the status of the FTP server on it. 我想从简单的桌面快捷方式执行许多操作,例如关闭无线或运行命令以检查其上的FTP服务器的状态。

I can do these from the 'system' tool which lets you execute shell commands and returns the output. 我可以通过'system'工具执行这些操作,该工具允许您执行shell命令并返回输出。

I have found from analysis of the markup on this page that this is done by way of a simple XMLHttp POST to shell.cgi , parameters action=execute&command=ls and the output is the STDOUT you'd get if you performed this on a local shell. 我从该页面上的标记分析中发现,这是通过一个简单的XMLHttp POST到shell.cgi ,参数action=execute&command=ls ,输出是你在本地执行此操作时得到的STDOUT贝壳。

How can I create a desktop shortcut to perform these posts and somehow echo the response? 如何创建桌面快捷方式来执行这些帖子并以某种方式回应响应?

What I have figured I could do so far is to make an HTML file which launches a POST using jQuery using some predefined function depending on URI segments, which I'd vary for each of the shortcut files. 到目前为止,我认为我可以做的是制作一个HTML文件,使用jQuery根据URI段使用一些预定义的函数启动POST,我对每个快捷方式文件都有所不同。

However does anyone know a better way of doing this programatically under Windows? 但有没有人知道在Windows下以编程方式执行此操作的更好方法?

Use wget, which has a windows port. 使用wget,它有一个Windows端口。 http://gnuwin32.sourceforge.net/packages/wget.htm http://gnuwin32.sourceforge.net/packages/wget.htm

wget --post-data 'action=execute&command=ls' http://router/shell.cgi

You can run the command from a batch file on your desktop. 您可以从桌面上的批处理文件运行该命令。

This is just a trick to do the same. 这只是一个伎俩。

  1. Create a File like executeThisPostRequest.sh 创建一个像executeThisPostRequest.sh这样的文件
  2. Add the following lines in that file 在该文件中添加以下行

    curl --data "userName=Dileep&MyPassword=SameAsYours" http://10.0.1.1/login?
    exit

  3. Navigate to the File path where executeThisPostRequest.sh is located using terminal. 使用终端导航到executeThisPostRequest.sh所在的文件路径。

  4. Execute chmod a+x shellscript.execute.sh 执行chmod a+x shellscript.execute.sh
  5. Right click on the file and select execute using terminal. 右键单击该文件,然后选择使用终端执行。

    Open with >> Other >> all Application >> Utilities >> Terminal

    Remember settings if you want. 如果需要,请记住设置。

Now you you can click on that file to execute a post request to the URL with the data you have specified. 现在,您可以单击该文件以使用您指定的数据对URL执行发布请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从桌面快捷方式运行命令提示符命令 - Run a Command Prompt command from Desktop Shortcut 如何从桌面快捷方式显示/隐藏任务栏 - How to show/hide taskbar from a desktop shortcut 是否有一种从桌面删除快捷方式的特殊方法? - Is there a special method to remove a shortcut from a desktop? 从桌面快捷方式运行 Outlook 宏 - Run Outlook macro from desktop shortcut 桌面上的 Ionic PWA 快捷方式 - Ionic PWA shortcut on desktop 从桌面快捷方式的快捷键运行C#程序时,GetForegroundWindow不起作用 - GetForegroundWindow not working when C# program is run from a shortcut key of a desktop shortcut 以编程方式为桌面“快捷方式”创建快捷键组合 - Programmatically create shortcut keys combo for desktop “shortcut” 用于重启Windows服务的桌面快捷方式 - Desktop shortcut to restart a windows service 在 Windows 桌面上创建快捷方式图标 - Creating a shortcut icon on the Windows desktop 某些用户操作更改了链接href后,从Chrome到桌面的拖放链接无法创建正确的桌面快捷方式 - Drag&dropping link from Chrome to desktop does not create a correct desktop shortcut after the link href was changed by some user action
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM