Changeset 2902 for trunk/admin/include
- Timestamp:
- Nov 23, 2008, 6:23:57 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/functions.php
r2900 r2902 1949 1949 function fetchRemote($src, &$dest, $user_agent='Piwigo', $step=0) 1950 1950 { 1951 // Try to retrieve data from local file? 1952 if (!url_is_remote($src)) 1953 { 1954 $content = @file_get_contents($src); 1955 if ($content !== false) 1956 { 1957 is_resource($dest) ? @fwrite($dest, $content) : $dest = $content; 1958 return true; 1959 } 1960 else 1961 { 1962 return false; 1963 } 1964 } 1965 1951 1966 // After 3 redirections, return false 1952 1967 if ($step > 3) return false; … … 1965 1980 $content = @curl_exec($ch); 1966 1981 $header_length = @curl_getinfo($ch, CURLINFO_HEADER_SIZE); 1982 $status = @curl_getinfo($ch, CURLINFO_HTTP_CODE); 1967 1983 @curl_close($ch); 1968 if ($content !== false )1984 if ($content !== false and $status >= 200 and $status < 400) 1969 1985 { 1970 1986 if (preg_match('/Location:\s+?(.+)/', substr($content, 0, $header_length), $m))
Note: See TracChangeset
for help on using the changeset viewer.