|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-11-29 10:41 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 15:00:01 2025 UTC |
**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!