Bug #51852 [Bgs]: file_get_contents not working with hhtp urls
| From: | pajoye@php.net | Date: | Tue, 18 May 2010 14:56:15 +0000 |
| Subject: | Bug #51852 [Bgs]: file_get_contents not working with hhtp urls | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-150570@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51852&edit=1
ID: 51852
Updated by: pajoye@php.net
Reported by: laurent at roussanne dot com
Summary: file_get_contents not working with hhtp urls
Status: Bogus
Type: Bug
Package: Streams related
Operating System: windows server 2008 64 bits
PHP Version: 5.2.13
New Comment:
It is not. It works (win7/2k8/2k8R2, x64 or x86). Please ask further
support on php-windows or php-general mailing list.
Previous Comments:
------------------------------------------------------------------------
[2010-05-18 16:43:18] laurent at roussanne dot com
allow_url_include On On
It is not a network problem because curl based workaround works !
I'm sure it is a windows 64 bits specific problem (2008 server, vista,
or seven).
------------------------------------------------------------------------
[2010-05-18 16:38:13] pajoye@php.net
Yes, windows is my main platform. Did you allow allow_url_fopen in your
php.ini?
But again: It does work. If it does not, then something is wrong in your
configuation.
------------------------------------------------------------------------
[2010-05-18 16:34:53] laurent at roussanne dot com
I worked to find a workaround all the last weekend.
the solution was writing this :
function win64_file_get_contents($url, $timeout=5)
{
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
if (is_bool($file_contents) && ($file_contents == FALSE))
{
return FALSE;
}
else
{
return $file_contents;
}
}
I'm sure you know this code (found on the web).
Do you have a windows 2008 64 test platform ?
------------------------------------------------------------------------
[2010-05-18 16:27:20] pajoye@php.net
Works just fine. Verify your network connections or whatever you use to
connect to internet. I suppose a simple:
file_get_contents("http://127.0.01/"); will work just
fine too for you
(as long as you have 127.0.0.1 define).
------------------------------------------------------------------------
[2010-05-18 16:21:34] laurent at roussanne dot com
Description:
------------
file_get_contents("http://www.php.net");
reports :
failed to open stream: Une tentative de connexion a échoué car le
parti connecté
n'a pas répondu convenablement au-delà d'une certaine durée ou une
connexion
établie a échoué car l'hôte de connexion n'a pas répondu.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51852&edit=1