Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
fopen remote ftp file
Old 04-09-2005, 09:12 PM fopen remote ftp file
Average Talker

Posts: 20
Trades: 0
I am trying to write to a file (non-existing) using fopen() via ftp. So i try this:
PHP Code:
<?php 
$content 
"whatever"
$file "ftp://user:pass@server.com/public_html/dir/9999.txt"
$handle fopen($file"w"); 
if (!
$handle

echo 
"Error opening $file"

else { 
fwrite ($handle$content); 
echo 
"success"
fclose($handle); 

?>
And what i get is an error (echo "Error opening $file"; - that one) and empty 9999.txt
This is really weird, because i think it should work. I checked allow_url_fopen, and its on. In fact, i can't even read any file.
Do you know how can i make this work? Thank you
tima89 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-10-2005, 03:44 AM
pitbull82's Avatar
Super Talker

Posts: 147
Name: Marcin Nabiałek
Location: Poland, Częstochowa
Trades: 0
Well, I don't know if you can open files via FTP protocol in "w" mode cause in manual states that if you want to modify files via FTP you should rather use ftp_connect function.

Another thing is - are you sure that chmods for the file permit you to modify the content of the file?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
pitbull82 is offline
Reply With Quote
View Public Profile Visit pitbull82's homepage!
 
Old 04-10-2005, 06:28 AM
Average Talker

Posts: 20
Trades: 0
I saw hundreds of similar examples of writing to remote ftp file with w mode in google. They all say that i can add a file, but i can't edit it. And in my example the file i am writing to is also non-existant. Please help, i don't know what to do
tima89 is offline
Reply With Quote
View Public Profile
 
Old 04-10-2005, 07:07 AM
pitbull82's Avatar
Super Talker

Posts: 147
Name: Marcin Nabiałek
Location: Poland, Częstochowa
Trades: 0
If you really want sb to help you, give us the exact FTP with user/pass that we could test it...
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
pitbull82 is offline
Reply With Quote
View Public Profile Visit pitbull82's homepage!
 
Reply     « Reply to fopen remote ftp file
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.02921 seconds with 12 queries