php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30522 Unable to connect to addresses in the form of "http://www.site.com/xxx.html"
Submitted: 2004-10-21 22:47 UTC Modified: 2004-10-23 08:29 UTC
From: kianhuay at pacific dot net dot sg Assigned:
Status: Not a bug Package: HTTP related
PHP Version: 5.0.2 OS: Windows
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kianhuay at pacific dot net dot sg
New email:
PHP Version: OS:

 

 [2004-10-21 22:47 UTC] kianhuay at pacific dot net dot sg
Description:
------------
My code is supposed to read contents of a remote site into a string.

It works as expected when I use "http://www.site.com" as the url, but when I use "http://www.site.com/xxx.html" it gives an error.

Reproduce code:
---------------
list($protocol, $uri) = split('//', "http://www.site.com/xxx.html");
$html = file_get_contents($protocol . '//' . urlencode($uri));
echo $html;

Expected result:
----------------
I expect to read the contents of the remote site into a string, but I get an error instead:

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\Program Files\Apache Group\Apache2\htdocs\index.php on line 14


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-23 08:29 UTC] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Not a bug - you're trying to get 
http://www.site.com%2Fxxx.html
instead of 
http://www.site.com/xxx.html
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 14:01:32 2025 UTC