Why fopen failed to open the file?

General discussions related to php

Moderators: macek, egami, gesf

13e
New php-forum User
New php-forum User
Posts: 5
Joined: Sun Jun 22, 2003 6:35 pm

Why fopen failed to open the file?

Postby 13e » Sun Jun 22, 2003 6:48 pm

<?
$l =
fopen("http://appledaily.atnext.com/template/apple/sec_main.cfm","r");
fclose($l);
?>

why can't open the file?

thx!

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Re: Why fopen failed to open the file?

Postby Redcircle » Sun Jun 22, 2003 9:47 pm

Make sure php has support for URL's

php documentation wrote:If PHP has decided that filename specifies a registered protocol, and that protocol is registered as a network URL, PHP will check to make sure that allow_url_fopen is enabled. If it is switched off, PHP will emit a warning and the fopen call will fail.


13e
New php-forum User
New php-forum User
Posts: 5
Joined: Sun Jun 22, 2003 6:35 pm

Re: Why fopen failed to open the file?

Postby 13e » Sun Jun 22, 2003 10:31 pm

allow_url_fopen is enabled

I have no problem to open any other url file, except this one.
It even crashed my php.

I guess there is some kind of trick to prohibit others to open and read the file.

Try and you will see.

KC

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Postby Redcircle » Sun Jun 22, 2003 10:41 pm

check the file permissions make sure you have read access. That is if it's on your server.

13e
New php-forum User
New php-forum User
Posts: 5
Joined: Sun Jun 22, 2003 6:35 pm

Postby 13e » Sun Jun 22, 2003 10:49 pm

http://appledaily.atnext.com/template/a ... c_main.cfm

is accessable by browser. Does it mean it is readable?

KC

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Postby Redcircle » Sun Jun 22, 2003 11:19 pm

Reading docs on php.net this is cause by the url producing a Circular redirect. Thus this file cannot be read via the URL. If this is your webpage I would suggest using the path from the server and not a URL.

13e
New php-forum User
New php-forum User
Posts: 5
Joined: Sun Jun 22, 2003 6:35 pm

Postby 13e » Sun Jun 22, 2003 11:45 pm

It is not my web.
Is there any workaround to open and read the file?

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Postby Redcircle » Tue Jun 24, 2003 11:49 pm

from what i read in the docs this happens because there is a redirect in the website. So I do not believe there is a workaroud.


Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 2 guests