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
How to send a file delete command via php?
Old 02-09-2006, 07:54 PM How to send a file delete command via php?
Novice Talker

Posts: 4
Trades: 0
Is there anyway to delete a file on another web site using php. If I have the ftp user and password can I send a command to delete file on another domain. What I need to do is grab the stat file from 1,000 domains and then delete that stat file so it can start building new stats from scratch each 24 hours. I suppose I could place a php on the domain that I could call up that file and have it delete the file, but that means I would have to place 1,000 php files, one on each domain.
Anyone have any ideas on how to make this happen. Is there any sort of ftp program that could be actived by cron job that could do this?
tommytx is offline
Reply With Quote
View Public Profile Visit tommytx's homepage!
 
 
Register now for full access!
Old 02-10-2006, 05:53 AM Re: How to send a file delete command via php?
stOx's Avatar
Machine

Latest Blog Post:
Worlds Smallest Car - Peel P50
Posts: 2,111
Name: Matt. (>',')>
Location: London, England.
Trades: 0
PHP can open an FTP connection easily, So i would guess it should just be a case of starting the FTP session then sending the ftp_delete().

I have never done anything like this, But looking at php.net this looks like the code you are looking for (or at least something similar)
PHP Code:
<?php
// remote file to delete
$file 'public_html/old.txt';

// The server
$ftp_server "ftp.server.com";

// set up basic connection
$conn_id ftp_connect($ftp_server);

// login with username and password
$login_result ftp_login($conn_id$ftp_user_name$ftp_user_pass);

// try to delete $file
if (ftp_delete($conn_id$file)) {
 echo 
"$file deleted successful\n";
} else {
 echo 
"could not delete $file\n";
}

// close the connection
ftp_close($conn_id);
?>
__________________

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

Last edited by stOx; 02-10-2006 at 05:55 AM..
stOx is offline
Reply With Quote
View Public Profile Visit stOx's homepage!
 
Reply     « Reply to How to send a file delete command via php?
 

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 0.67671 seconds with 12 queries