note 46879 deleted from function.file-get-contents by nlopess
| From: | nlopess@php.net | Date: | Wed, 27 Oct 2004 14:44:01 +0000 |
| Subject: | note 46879 deleted from function.file-get-contents by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-79185@lists.php.net to get a copy of this message | ||
Note Submitter: ben at zygoat dot ca
----
The above code example:
<?php
$url = 'http://example.com/with funny chars';
list($protocol, $uri) = split('//', $url);
$html = file_get_contents($protocol . '//' . urlencode($uri));
?>
does not work. The slash trailing "example.com" will be turned into %2F, and the resolver
fails to find a host named "example.com%2F".
Did nobody test this?
I cannot immediately see a workaround, short of doing a str_replace after the urlencode to turn %2F
back into slashes. Anyone?
-ben