Jump to content


Photo

Php Write CHMOD 777 Remotely


  • Please log in to reply
1 reply to this topic

#1 anup09

anup09
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 26 October 2006 - 01:45 AM

i want to know how to write files from 1 server to another..

say i had a stats script on 1 server that logs to a file called log.txt on the same server as the script.. what if i wanted the script to log onto the other server in a folder chmodded 777.. is that possible.. how can i do it ??..




#2 ksteuber

ksteuber
  • Members
  • PipPipPip
  • Advanced Member
  • 32 posts
  • LocationCalifornia, USA

Posted 28 October 2006 - 04:11 AM

I suppose you could ftp in with something like:
<?php
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if ((!$conn_id) || (!$login_result)) {
       echo "Could not connect to the FTP server";
       exit;
   }
$upload = ftp_put($conn_id, 'log.txt', 'log.txt', FTP_BINARY);

if (!$upload) {
       echo "Could not upload to the FTP server";
   }
ftp_close($conn_id);
?> 

Is that what you had in mind?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users