直接使用javascript的話, 我們可以這樣寫:
window.location = "url_to_redirect";
這樣的結果類似滑鼠點擊連結, 會在瀏覽器的瀏覽歷史留下原網址的記錄.
也可以這麼寫:
window.location.href = "url_to_redirect";
如此與上例一樣類似滑鼠點擊連結.
另外, 也可以這麼寫:
直接使用javascript的話, 我們可以這樣寫:
window.location = "url_to_redirect";
這樣的結果類似滑鼠點擊連結, 會在瀏覽器的瀏覽歷史留下原網址的記錄.
也可以這麼寫:
window.location.href = "url_to_redirect";
如此與上例一樣類似滑鼠點擊連結.
另外, 也可以這麼寫:
hping3 -I eth1 --udp --rand-source 192.168.1.100
hping3 -I eth1 --udp --rand-dest 192.168.1.100
hping3 -I eth1 --syn --rand-source 192.168.1.100
hping3 -I eth1 --syn --rand-dest 192.168.1.100
hping3 -I eth1 --rand-source 192.168.1.100
hping3 -I eth1 --rand-dest 192.168.1.100
git clone --mirror git@[IP:/Path_to_git]
git fetch -q --all -p
git push
git checkout --track -b foobar origin/foobar
git branch -d local_branch
curl --user user:password http://192.168.101.192/
curl -H "Accept-Language: zh-tw"
curl http://www.example.com -D savecookie.txt
curl -b usecookie.txt http://www.example.com
curl -d "user=xxx&password=1234" http://example.com/login.cgi
curl -A "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" http://www.example.com
curl -L -o ab.zip https://www.dropbox.com/sh/zls0quiliwzo82e/AAC_Co6-7dxl8M-vOFGTc_0ua?dl=1
X 後面加 http method,
curl -X GET "http://www.rest.com/api/users" curl -X POST "http://www.rest.com/api/users" curl -X PUT "http://www.rest.com/api/users" curl -X DELETE "http://www.rest.com/api/users"
http參數可以直接加在url的query string,也可以用-d帶入參數間用&串接,或使用多個-d
# 使用`&`串接多個參數 curl -X POST -d "param1=value1¶m2=value2" # 也可使用多個`-d`,效果同上 curl -X POST -d "param1=value1" -d "param2=value2" curl -X POST -d "param1=a 0space" # "a space" url encode後空白字元會編碼成'%20'為"a%20space",編碼後的參數可以直接使用 curl -X POST -d "param1=a%20space"
如同時需要傳送request parameter跟json,request parameter可以加在url後面,json資料則放入-d的參數,然後利用單引號將json資料含起來(如果json內容是用單引號,-d的參數則改用雙引號包覆),header要加入”Content-Type:application/json”跟”Accept:application/json”
curl http://www.example.com?modifier=kent -X PUT -i -H "Content-Type:application/json" -H "Accept:application/json" -d '{"boolean" : false, "foo" : "bar"}' # 不加"Accept:application/json"也可以 curl http://www.example.com?modifier=kent -X PUT -i -H "Content-Type:application/json" -d '{"boolean" : false, "foo" : "bar"}'
http://blog.kent-chiu.com/2013/08/14/testing-rest-with-curl-command.html