You are here: Can not open url using fopen or file « PHP Programming Language « IT news, forums, messages
Can not open url using fopen or file

Posted by Brian on 09/08/07 01:46

Hi

I have a problem in opening url using 'file'.
I searched many other discussion groups and tried suggestions,
but could not resolve this problem.
e.g

<?php
$myfile = file('http://google.com');
foreach ( $myfile as $vals){
print "$vals";
}
?>

I got an error: failed to open stream: Permission denied.

The above script works on my windows pc, but does not work on Linux
(Fedora 5, php v5.1.2). I found there was no difference between windows
php.ini and linux php.ini. But it does not work on the Linux web
browser. I also tested with fopen and fsockopen, but did not work.
allow_url_fopen was set to On.

I did some other tests:
1. % php -f /var/www/index.html // works on the linux command line
// each of the following three lines was tested in the above script.
2. file('/var/www/index.html'); // this works on the Linux web browser.
3. file('http://localhost/index.html'); // failed to open stream:
permission denied.
4. file('http://google.com'); // failed to open stream: permission denied.

Any possibility for firewall (internet works fine) or other
configuration issues?

Could anyone can help me please?

bk

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация