通过CURL编写脚本提交请求到服务器

Below shows a simple example of how to delete all policies by using command-line. Usually we will login to http://ip:port/ts/admin/ and go to “Security Policy Editor” tab. Then select all registered policies and click “Delete”. The “Delete” function does not implement through Webservice. If you want to access the function in your automation code or application, you can try the following method: Before you begin please ensure that your machine has CURL binary installed. Create a new shell script: #vi delPol.sh

curl --insecure --silent -d "j_username=wsadmin&j_password=was4me" --cookie-jar fee.cookie https://ip:port/ts/ui/jsp/j_security_check
 
curl --insecure --cookie fee.cookie --referer -d "https://ip:port/ts/ui/SpeServlet?pageId=DeletePolicies&selectAll=on&policyId=2"

Execute the shell script. #./delPol.sh 第一行curl命令是进行Servlet容器的安全验证。 第二航curl命令是通过firebug的网络标签提取出来的POST/GET request URL。

1 Comment on this Post.

  1. You can also use a wig styling comb to separate curls. Hide Http Referrer

Leave a Comment.