Re: Open URL with UTF8 name

From: Date: Fri, 09 Nov 2007 16:19:34 +0000
Subject: Re: Open URL with UTF8 name
References: 1  Groups: php.i18n 
Request: Send a blank email to php-i18n+get-1127@lists.php.net to get a copy of this message
Luyen Tran schreef:
Hi, I try to use PHP fopen to open the URL like the following http://dir.gigablast.com/World/Català/Economia_i_empresa/Serveis/Arts_i_entreteniment. What i got is the error Could not open the file. Here is the code $filename = "http://dir.gigablast.com/World/Català/Economia_i_empresa/Serveis/Arts_i_entreteniment"; fopen($filename, "r") || die ("Could not open file"); However, using IE to browse to this page is successful. Could anyone help me with that. Thank alot, Luyen Tran
Dear Luyen Tran, I've just had a test and it works perfectly for me. This is my code: <?php $file = 'http://dir.gigablast.com/World/Catal%C3%A0/Economia_i_empresa/Serveis/Arts_i_entreteniment'; $r = fopen($file, 'r') or die('Cannot open file!'); $read = fread($r, 1024); fclose($r); print $read; ?> Make sure that your webhost allows remote fopen connections or if it allows the fopen function at all. Hope this helped. ~ Isaak Malik

« previous php.i18n (#1127) next »