-
url 為 http://mywebsite.com/index.php?a=1&b=2&c=3
-
web形式下訪問url地址,使用 $_GET是可以獲取到所有的參數
-
-
curl -s http://mywebsite.com/index.php?a=1&b=2&c=3
-
然而在linux下,上面的例子 $_GET只能獲取到參數 a
-
-
由於url中有&其他參數獲取不到,在linux系統中 &會使進程系統后台運行
-
必須對 &進行下轉義才能 $_GET獲取到所有參數
-
curl -s http://mywebsite.com/index.php?a=1\&b=2\&c=3
-
-
當然,最簡單的方法 用雙引號把整個url引起來就ok了
-
curl -s "http://mywebsite.com/index.php?a=1&b=2&c=3"
-
-
# 順便再提一下 curl 中 post 傳參數的方法
-
curl -d 'name=1&pagination=2'demoapp.sinap.com/worker.php
-
# 這樣 demoapp.sinap.com 站點中的 worker.php 腳本,就能得到 $_POST['name'] 和 $_POST[''pagination] 對應的值
-
-
# 再補充下curl獲得網站信息的方法( -s 表示靜默 --head 表示取得head信息 )
-
curl -s --head www.sina.com