|
 |
|
ผมไม่สามารถ ใช้ ftp_connect ไปที่ server อีกเครื่องนึงเพื่อ copy ไฟล์มาที่ server เครื่องแรกได้ |
|
 |
|
|
 |
 |
|
curl มั้งคับ ก็ไม่เคยลอง แต่คงไม่ยาก 
ไม่ก็ลอง fopen เลย ระบุโปรโตคอล ยูสเซอร์เนม พาสด้วย
|
 |
 |
 |
 |
Date :
2009-03-23 16:04:18 |
By :
pjgunner |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
// open some file for reading
$file = 'index.php';
$fp = fopen($file, 'w');
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// Initate the download
$ret = ftp_nb_fget($conn_id, $fp, $file, FTP_BINARY);
while ($ret == FTP_MOREDATA) {
// Do whatever you want
echo ".";
// Continue downloading...
$ret = ftp_nb_continue($conn_id);
}
if ($ret != FTP_FINISHED) {
echo "There was an error downloading the file...";
exit(1);
}
// close filepointer
fclose($fp);
?>
ลองเอาไปใช้ดูนะค่ะ
ที่มาโค๊ด ก็มาจาก www.php.net ค่ะ
|
 |
 |
 |
 |
Date :
2009-03-23 19:02:06 |
By :
นุกุล |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมากครับ
เดี๋ยวขอเวลาไปลองก่อนนะครับ

|
 |
 |
 |
 |
Date :
2009-03-24 09:47:03 |
By :
hahesf |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|