View Single Post
Old 07-12-2009   #15
polo
Registered Member
 
polo's Avatar
 
Last Online: 03-25-2010
Join Date: May 2008
Posts: 77
Thanks: 20
Thanked 23 Times in 18 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
Default

Quote:
Originally Posted by HizbullaH View Post
Bro I Don't Know What Do You Exactly Want, If You Can Tell Me And I Will Write For You The Script.. I Have Written This Sample Now For You And You Can Edit Or Continue It.. It Just Connects To FTP And Gets A Zipped File The Decompress It.. You Can Run It Using php-cli If You Want..

PHP Code:
<?php

// FTP Connection

$connection = @ftp_ssl_connect("YOURHOST") or die("WTF!! Unable To Connect To The Host!!\n"); // Put Your Host
$ftpuser "FTPUSERNAME"// Put Your FTP Username
$ftppass "FTPPASSWORD"// Put Your FTP Password
$login = @ftp_login($connection$ftpuser $ftppass );
$file "YOURFILE.zip"// Put The Name Of Your Compressed File


if (!$login) {
    echo 
"WTF!! Unable To Login!!\n";
             }
else {
    echo 
"Logged In! O'RLY? YA'RLY.\n";
    }

// Put The Directory Of File In The FTP Server Down Here
@ftp_chdir($connection,"DIRECTORY/OF/FILE/ON/FTP/SERVER") or die("WTF!! Unable To Change Directory, Please Enter A Valid Directory.\n");

echo 
"Current Dir: ".ftp_pwd($connection)."\n";

$getfile = @ftp_get($connection$file$fileFTP_BINARY);

if (!
$getfile) {
    echo 
"WTF!! Unable To Get File.\n";
               }
else {
    echo 
"File Has Been Successfully Downloaded!.\n";
     }

//Unzipping The File

$zip = new ZipArchive;
$res $zip->open("$file");
if (
$res === TRUE) {
    
$zip->extractTo('Extracted-FTP-TMP/');
    
$zip->close();
    echo 
"The File Has Been Successfully Unziped!\n";
} else {
    echo 
"WTF!! Unable To Decompress The File!!\n";
}

@
ftp_close($connection) or die("WTF!! Unable To Close Connection!!\n");
?>
i just saw this. thx a lot!
i'll tweak it & give it a try and revert if i need anything
thx again!
polo is offline   Reply With Quote