[英]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. 这只是一个伎俩。
executeThisPostRequest.sh
executeThisPostRequest.sh
这样的文件 Add the following lines in that file 在该文件中添加以下行
curl --data "userName=Dileep&MyPassword=SameAsYours" http://10.0.1.1/login?
exit
Navigate to the File path where executeThisPostRequest.sh
is located using terminal. 使用终端导航到
executeThisPostRequest.sh
所在的文件路径。
a+x shellscript.execute.sh
a+x shellscript.execute.sh
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.