fopen not working on remote files

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jorj
Forum Newbie
Posts: 7
Joined: Tue Jul 14, 2009 8:54 pm

fopen not working on remote files

Post by jorj »

please help


i am using this code

Code: Select all

fopen("http://localhost/file.php", "w+")
but the output is always

Warning: fopen(http://localhost/file.php) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections in X:\xampp\htdocs\editor.php on line 27

how should i access a remote file???
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: fopen not working on remote files

Post by Darhazer »

You cannot access remote file for writing (unless the remote file is not mounted by the operating system). You have to access a PHP script on the remote server, that works with the file...
jorj
Forum Newbie
Posts: 7
Joined: Tue Jul 14, 2009 8:54 pm

Re: fopen not working on remote files

Post by jorj »

i'm sorry for that what i mean is that i can't access files using http

is there a problem with localhost

how should i do that?

please help...


just a beginner... first month
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: fopen not working on remote files

Post by Darhazer »

If you want to read file, use:
fopen("http://localhost/file.php", "r")
If you want to write to the file... you can't
What will happen if everyone could write to every site he wants?
Post Reply