所以。如果我使用fopen通過HTTP打開遠程文件,將如何獲得內容大小
$f = fopen('http_url_site_com_my_file_ext');
$info = stream_get_meta_data($f);
http://us1.php.net/manual/ru/function.stream-get-meta-data.php
正如我們在文檔閱讀,我可以找到
echo $info['wrapper-data'][#] ; // --> Content-length: 438;
也
echo $info['wrapper_type']; //--> http
內容lenth就我而言,我看到 捲曲而不是http
and
$info['wrapper-data']['headers']; //empty array
所以我無法得到答覆的長度。
=========== 信息http://www.php.net/manual/en/reserved.variables.httpresponseheader.php
我們可以得到響應頭這樣
$f = fopen('http_url_site_com_my_file_ext');
var_dump($http_response_header); // --> null.
$data = fread($f, 100);
var_dump($http_response_header); // --> array of all response headers.
但它是非常非常壞我的代碼。我們在開始時打開了很多文件(如果其中一個文件是錯誤的 - die())
然後,我們從打開的文件中讀取數據。
============ QUESTION
1)如果我將編譯沒有 「--with-curlwrappers」,爲什麼這個實驗功能是本PHP ??? --- PHP 5.4.21(PHP-FPM) ---中的phpinfo,我看不出有什麼構建選項爲 '--with-curlwrappers' 不讀流
2) 或者我如何能得到響應頭
???
請幫幫我。
沒有。額外的請求。我沒有空閒時間。一個文件=一個請求。 – user3032727
也,我打開本地文件,將來我會使用套接字,其他協議。 – user3032727
所以我需要相同的接口來讀取數據。 – user3032727