php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37894 failed to open stream: HTTP request failed!
Submitted: 2006-06-22 20:13 UTC Modified: 2006-07-30 01:00 UTC
Votes:15
Avg. Score:4.4 ± 1.1
Reproduced:10 of 12 (83.3%)
Same Version:1 (10.0%)
Same OS:2 (20.0%)
From: roclar at gmail dot com Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 4.4.2 OS: Solaris 10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
50 + 15 = ?
Subscribe to this entry?

 
 [2006-06-22 20:13 UTC] roclar at gmail dot com
Description:
------------
Doing an include('http://www.example.com/'); for names local 
to the server hang and eventually time out a minute later.  
Using include for external names as well as to localhost and 
127.0.0.1 all work as expected.  External servers can use 
include() to load pages on this server.

php.ini Fopen wrappers:
allow_url_fopen = On
default_socket_timeout = 60

Compile time options:

LD_LIBRARY_PATH=/oraclesw/instantclient_10_2
export LD_LIBRARY_PATH
./configure \
        --prefix=/usr/local/$1 \
        --with-apxs=/usr/local/apache/bin/apxs \
        --with-ldap=/usr/local \
        --with-mysql=/usr/local/mysql \
        --with-oci8-instant-client=/oraclesw/
instantclient_10_2 \
        --with-ftp \
        --with-gd \
        --with-gettext \
        --with-iconv \
        --with-jpeg-dir=/usr/sfw \
        --with-openssl=/usr/sfw \
        --with-png-dir=/usr/sfw \
        --with-zlib \
        --with-zlib-dir \
        --with-dom=/usr/local \
        --with-dom-xslt=/usr/local \
        --with-dom-exslt=/usr/local \
        --enable-sockets \
        --enable-track-vars \
        --enable-xml \
        --with-expat-dir=/usr/local \
        --enable-mbstring=all \
        --with-pspell=/usr 

Reproduce code:
---------------
<?php

include('http://www.example.com/');

?>

Expected result:
----------------
For the page to be included successfully.

Actual result:
--------------
Warning: main(http://www.example.com/): failed to open stream: 
HTTP request failed! in /path/to/script/testit.php on line 3

Warning: main(): Failed opening 'http://www.wm.edu/it/' for 
inclusion (include_path='.:/usr/local/php/lib/php') in /path/
to/script/testit.php on line 3

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-23 14:22 UTC] roclar at gmail dot com
Recompiled with the same options with the same result though 
the error messages seemed to be formatted slightly 
different:

Warning: main(http://www.example.com/) [function.main]: 
failed to open stream: HTTP request failed! in /path/to/
script/testit.php on line 3

Warning: main() [function.include]: Failed opening 'http://
www.example.com/' for inclusion (include_path='.:/usr/local/
php/lib/php') in /path/to/script/testit.php on line 3
 [2006-06-23 14:39 UTC] tony2001@php.net
What is the web-server used on this host (aka "example.com") and are you able to connect to it using telnet or something else?
 [2006-06-23 14:44 UTC] roclar at gmail dot com
The web server is Apache/1.3.36 (Unix)

I have command line access to the host and can compile, start/
stop, etc.
 [2006-06-23 14:52 UTC] tony2001@php.net
But are you able to connect to this server from the same host where your PHP script is located?
 [2006-06-23 15:00 UTC] roclar at gmail dot com
I could use wget on the server and get the same result.
 [2006-06-23 15:14 UTC] tony2001@php.net
The "same result"? I.e. "unable to connect"?
 [2006-06-23 15:20 UTC] roclar at gmail dot com
<br />
<b>Warning</b>:  main(http://www.example.com/) [<a 
href='function.main'>function.main</a>]: failed to open 
stream: HTTP request failed!  in <b>/path/to/script/
testit.php</b> on line <b>3</b><br />
<br />
<b>Warning</b>:  main() [<a 
href='function.include'>function.include</a>]: Failed 
opening 'http://www.example.com/' for inclusion 
(include_path='.:/usr/local/php/lib/php') in <b>/path/to/
script/testit.php</b> on line <b>3</b><br />
 [2006-06-23 15:30 UTC] tony2001@php.net
Again. Please try to connect to this web-server (aka example.com) using a telnet or wget or something else from the server where the script is located. I want you to do this because I suspect there is a firewall or a proxy or some other reason which prevents you from connecting from one server to another.
What you need to do: login to the server, run `telnet <example.com> 80` (or wget example.com/some_page.html), make sure you're able to get the data.
 [2006-06-23 16:12 UTC] roclar at gmail dot com
That last comment was retreived using wget from the command 
line on the server that hosts both the php script.  It is 
also the server where I am trying to pull the data from.  If 
I wget http://www.example.com directly, I get the data:

--12:10:28--  http://www.example.com/
           => `index.html'
Resolving www.example.com... 127.0.0.1
Connecting to www.example.com[127.0.0.1]:80... connected.
HTTP request sent, awaiting response... 200 OK
 [2006-07-22 12:19 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2006-07-30 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-08-26 06:00 UTC] subathrap at sevenstrata dot com
Doing to send an sms through third party url using file function then i got the following error. Same code i have used in /var/www/html/sam.php then i got the sms. I dont know why its not working when put into projects folder. 

[Warning] file(http://url.com?pcode=Test&amp;acode=Test&amp;mnumber=9894994999&amp;message=Your activation code is gUPaVy for the CI of 72087&amp;pin=test2934) [<a href='function.file'>function.file</a>]: failed to open stream: HTTP request failed! HTTP/1.0 501 Not Implemented (@line 396 in file /var/www/html/CustomerManagement/protected/Common/MCICommon.php).

Please help me.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 10:01:26 2024 UTC