Bug #60406 [Com]: file_exists() fopen() problems with URL (http)

From: Date: Wed, 30 Nov 2011 02:43:51 +0000
Subject: Bug #60406 [Com]: file_exists() fopen() problems with URL (http)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-165572@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60406&edit=1 ID: 60406 Comment by: reeze dot xia 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: Hi, simon: @see http://docs.php.net/manual/en/wrappers.http.php The Options "Wrapper Summary" section the http wrapper doesn't support stat() and file_exists() rely on that. http stream wrapper support fopen. file_exits() dones't support all the enabled stream wrappers. You can visit http://cn2.php.net/manual/en/wrappers.php for a full supported streams. thanks. Previous Comments: ------------------------------------------------------------------------ [2011-11-29 17:01:04] simon dot georget at gmail dot com **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! ------------------------------------------------------------------------ [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

« previous php.bugs (#165572) next »