|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51852 file_get_contents not working with hhtp urls
Submitted: 2010-05-18 16:21 UTC Modified: 2010-05-18 17:11 UTC
From: laurent at roussanne dot com Assigned:
Status: Not a bug Package: Streams related
PHP Version: 5.2.13 OS: windows server 2008 64 bits
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: laurent at roussanne dot com
New email:
PHP Version: OS:


 [2010-05-18 16:21 UTC] laurent at roussanne dot com

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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-18 16:27 UTC]
-Status: Open +Status: Bogus
 [2010-05-18 16:27 UTC]
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 define).
 [2010-05-18 16:34 UTC] 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);
    if (is_bool($file_contents) && ($file_contents == FALSE))
        return FALSE;
        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:38 UTC]
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:43 UTC] 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:56 UTC]
It is not. It works (win7/2k8/2k8R2, x64 or x86). Please ask further support on php-windows or php-general mailing list.
 [2010-05-18 17:11 UTC] laurent at roussanne dot com
perhaps a French windows 2008 server OS specific issue ?

The bug appears even with the command line interface.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 16 01:01:29 2024 UTC