<?phpfunction fetch($url){$ch = curl_init();curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_NOBODY, FALSE); //表示需要response bodycurl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 15); curl_setopt($ch,CURLOPT_HTTPAUTH,CURLAUTH_DIGEST);curl_setopt($ch, CURLOPT_GET, 1);$data = curl_exec($ch);curl_close($ch);return $data;} $url = ""; $url = "http://192.168.1.173:8080/cas/casrs/hostpool/all";$yy = fetch($url); echo $yy; echo xx;
我將這個文件放到apache下面,然后訪問這個文件,我想實現(xiàn)的命令是
curl -v --digesthttp://192.168.1.173:8080/cas...
我已經(jīng)設(shè)置digest,curl_setopt($ch,CURLOPT_HTTPAUTH,CURLAUTH_DIGEST);
還應(yīng)該設(shè)置什么,謝謝