我嘗試使用下面的代碼流通過PHP的使用IPCAMERA的ReadFile()以流網絡攝像頭;400錯誤的請求 - 試圖在外部URL
<?
# Stop apache timing out
set_time_limit(0);
# Set the correct header
header('Content-Type: multipart/x-mixed-replace;boundary=ipcamera');
# Read the images
readfile('http://[USER]:[PASSWORD]@[IPADDRESS]:[PORT]/videostream.cgi');
?>
這個腳本在運行Apache和PHP我的本地主機就好了,但是我的Web服務器上(2個服務器測試),我收到一個400錯誤請求錯誤。我以前收到'連接被拒絕'的錯誤,但這是通過我的主機轉發正確的端口來解決的。
是400不是一些不正確的語法?這可能是因爲我有「[用戶]:[PASSWORD] @」在網址中?如果是這樣,是否有另一種方式可以在運行readfile之前進行身份驗證?
我已經運行在下列情況下確定的響應的代碼;
readfile('http://[USER]:[PASSWORD]@[IPADDRESS]:[PORT]/NONEXISTINGFILE.cgi');
// Returns 400 Bad Request (Should be 404)
readfile('http://[IPADDRESS]:[PORT]/NONEXISTINGFILE.cgi');
// Returns 404 Not Found (Correct Response)
readfile('http://[IPADDRESS]:[PORT]/videostream.cgi');
// Returns 401 Unauthorized (Correct Response)
readfile('http://[USER]:[PASSWORD]@[IPADDRESS]:[PORT]/videostream.cgi');
// Returns 400 Bad Request (Incorrect - Should be .. 200(?) OK)
readfile('http://[USER]:[PASSWORD]@[IPADDRESS]:[PORT]/FILETHATDOESEXIST.jpg');
// Returns 400 Bad Request (Should be 200(?) OK)
readfile('http://[IPADDRESS]:[PORT]/FILETHATDOESEXIST.jpg');
// Returns 200(?) OK (Correct Response)
如果有人能夠給我這個腳本的捲曲等效物,也許這是解決方案。賞金仍然站立的人誰可以解決這個對我來說:)
問候,
** 400 **請求不能被服務器由於語法錯誤理解。 – sdolgy
我明白這個錯誤,只是不知道如何阻止它:P – Joel
如果您嘗試訪問除videostream.cgi以外的任何內容會發生什麼?對於非現有文件,你會得到正常的404錯誤嗎?可以正常下載的文件的工作? – Johan