我有一臺dvr。有些相機連接到它。 可以通過互聯網上的網頁瀏覽器訪問dvr。 dvr受用戶名和密碼保護。 如何連接到網絡服務器而無需每次輸入登錄名和密碼? 有一種方法可以在PHP中執行它? 我用這個腳本訪問由php密碼保護的遠程DVR
<?
$username = "xxxx";
$password = "aaaa";
$base_url = "http://myip/cgi-bin/slogin/login.py";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $base_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
print_r($info);
curl_close($ch);
?>
當我連接,我得到的print_r的細節,但沒有別的:
Array ([url] => http://xx.xx.xxx.xx/cgi-bin/slogin/login.py [content_type] => text/html; charset=iso-8859-1 [http_code] => 200 [header_size] => 225 [request_size] => 121 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.823264 [namelookup_time] => 0.00104 [connect_time] => 0.120289 [pretransfer_time] => 0.120435 [size_upload] => 0 [size_download] => 1515 [speed_download] => 1840 [speed_upload] => 0 [download_content_length] => -1 [upload_content_length] => -1 [starttransfer_time] => 0.690632 [redirect_time] => 0 [certinfo] => Array ())
我看到有一個200 OK,所以我想連接的罰款。但如何繼續?我要進入weserver的網站嗎?
你想達到什麼目的?其不清楚你的問題 – 2011-05-31 23:25:04