php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27105 Cannot open remote URL's
Submitted: 2004-01-31 08:47 UTC Modified: 2004-02-06 11:23 UTC
Votes:7
Avg. Score:4.4 ± 0.9
Reproduced:7 of 7 (100.0%)
Same Version:1 (14.3%)
Same OS:2 (28.6%)
From: jprins at ision dot nl Assigned:
Status: No Feedback Package: HTTP related
PHP Version: 4.3.4 OS: Unix
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.
Password:
Status:
Package:
Bug Type:
Summary:
From: jprins at ision dot nl
New email:
PHP Version: OS:

 

 [2004-01-31 08:47 UTC] jprins at ision dot nl
Description:
------------
PHP issues this warning:

Warning: main(http://www.ccmplanet.com/): failed to open stream: HTTP request failed! in /home/sites/site90/web/testrss.php on line 17

Warning: main(): Failed opening 'http://www.ccmplanet.com/' for inclusion (include_path='.:/usr/local/lib/php') in /home/sites/site90/web/testrss.php on line 17

The weird thing is that this error only occurs on the 
combination of my server (http://www.refresh.cx) and 
the remote server (http://www.ccmplanet.com). 

I _can_ include other remote URL's and other sites that 
also use php-include from ccmplanet.com don't have problems accessing ccmplanet.com



Reproduce code:
---------------
URL: http://www.refresh.cx/testrss.php

Code in this file:

<?php
include("http://www.ccmplanet.com/");
var_dump($http_response_headers);
?>


Expected result:
----------------
It should just include the file (it worked for years, but since a few hours it stopped working, I suspect my hosting provider from changing (upgrading?) the system).
Yes, I already asked what they did (no reply sofar)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-31 10:46 UTC] jprins at ision dot nl
Tom, thanks for the quick response, the page still fails on my system.

Here's a link to phpinfo.

http://www.refresh.cx/php-info.php
 [2004-01-31 12:25 UTC] pollita@php.net
(1) In your test script dump the contents of $http_response_header, not $http_response_headers.

(2) Use readfile() when all you're including is content and not actual PHP code.  Using include() on a remote URL which you don't control is a security risk and a completely unnecessary one in this context.
 [2004-01-31 13:15 UTC] jprins at ision dot nl
Changed the include into readfile, but same result
 [2004-01-31 23:41 UTC] sniper@php.net
Works fine with latest CVS snapshot. Worked fine with PHP 4.2.2 too. :)

 [2004-02-01 03:29 UTC] jprins at ision dot nl
I don't think the weird characters in the error message are
normal?

Warning: readfile(http://www.ccmplanet.com/): failed to open stream: HTTP request failed! ?ES?@4???>??\@@???<?? in /home/sites/site90/web/testrss.php on line 5
 [2004-02-01 05:51 UTC] sniper@php.net
Why does it work fine for me? Using this script:

<?php
readfile("http://www.ccmplanet.com/");
var_dump($http_response_headers);
?>

I get the page contents and the correct headers..
So what is different? (I'm running the script with CLI)

 [2004-02-06 11:23 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

..and you should fix your server..

 [2004-09-02 08:18 UTC] maximander at gmail dot com
We at gerpok.com are also encountering this error. Using a packet sniffer and file(), as well as fsockopen() we tracked the problem to the fact that php is not sending a 'Host:' header, nor the double line return to mark the end of headers, but rather is stopping after the first line ("GET .... HTTP/1.0")
we have several questions:
1) shouldn't it use http/1.1 ?
2) why isn't it sending all the headers?
3) Why does it retry the "GET ..." several times rather than finishing the first one?
4) What the $#%^ are those funny characters in the error msg?

using fsockopen() we can send the "GET ..." and "Host..." headers manually and the request works fine.

PHP Version: 4.3.8
OS: Gentoo Linux(2.6.7 kernel)
Apache 2
Tried php 5.0.1,'--enable-debug' and yes, allow_url_fopen is set to On. 

email me if you want more specific info.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 21:01:33 2024 UTC