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
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 !
Your email address:
MUST BE VALID
Solve the problem:
45 - 35 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 15:01:29 2024 UTC