Edit report at https://bugs.php.net/bug.php?id=60406&edit=1
ID: 60406
User updated by: simon dot georget at gmail dot com
Reported by: simon dot georget at gmail dot com
Summary: file_exists() fopen() problems with URL (http)
Status: Open
Type: Bug
Package: *General Issues
Operating System: ubuntu oneiric
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
**Actually fopen() works correctly!!!**
if(!fopen('http://maps.googleapis.com/maps/api/js?sensor=false', 'r')) {
echo 'Problem loading the url';
} else {
echo 'it works!';
}
returns it works!
Previous Comments:
------------------------------------------------------------------------
[2011-11-29 10:41:42] simon dot georget at gmail dot com
Description:
------------
I'm using the following version of PHP on ubuntu : PHP Version 5.3.6-13ubuntu3.2
and have problems checking if an url exists with both fopen() and file_exists()
functions.
print_r(stream_get_wrappers()); returns :
Array ( [0] => https [1] => ftps [2] => compress.zlib [3] => compress.bzip2 [4]
=> php [5] => file [6] => glob [7] => data [8] => http [9] => ftp [10] => phar
[11] => zip )
(test script is above)
Test script:
---------------
if(!file_exists('http://maps.googleapis.com/maps/api/js?sensor=false')) {
echo 'Problem loading the url';
} else {
echo 'it works!';
}
Expected result:
----------------
it works!
Actual result:
--------------
Problem loading the url
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60406&edit=1