Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pc33c1_26126_08_hd.jpg /photos/pvo/transfertvo/photos/pc33c1/pc33c1_x48_08_hd.jpg 1a71ffb90de7628b8b1585b7e85c68e7
- get /photos/pvo/transfertvo/photos/pc33c1/pc33c1_x48_08_hd.jpg pc33c1_26126_08_hd.jpg
- $f = Get-Content "photos.txt"
- $i = 0
- foreach ($line in $f) {
- $fields = $line.Split("`t")
- $First = $fields[0]
- $Second = $fields[1]
- $Third = $fields[2]
- $number = $i++
- $url = $Second +" "+ $First
- write-host "Title is: "$First
- write-host "Path is: "$Second
- write-host "Hash is: "$Third
- write-host "Number is: " $number
- Write-Host "This is the url: " $url
- get $url
- Write-Host ""
- }
- $FTPServer = "ftp.example.com"
- $FTPUsername = "user"
- $FTPPassword = "pass"
- $credential = New-Object System.Net.NetworkCredential($FTPUsername, $FTPPassword)
- $FTP = [System.Net.FtpWebRequest]::Create($FTPServer)
- $FTP.Credentials=$credential
- $FTP.UseBinary = 1
- $FTP.KeepAlive = 0
- <?php
- $ftp_server = 'ftp.example.com';
- $ftp_user_name = 'user';
- $ftp_user_pass = 'pass';
- $remoteFilePath = '/data/photos.txt.zip';
- $localFilePath = $_SERVER['DOCUMENT_ROOT']."/path/";
- // 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);
- if ((!$conn_id) || (!$login_result)) {
- echo 'FTP connection has failed! Attempted to connect to '. $ftp_server. ' for user '.$ftp_user_name.'.';
- }else{
- echo 'FTP connection was a success.<br>';
- $directory = ftp_nlist($conn_id,'');
- echo '<pre>'.print_r($directory,true).'</pre>';
- $contents = ftp_nlist($conn_id, "/data/");
- var_dump($contents);
- $bla = ftp_nlist($conn_id, "/photos/");
- var_dump($bla);
- ftp_pasv($conn_id, true);
- if (ftp_get($conn_id, $localFilePath.'/photos.txt.zip', $remoteFilePath, FTP_BINARY)) {
- echo "File has been downloaded!!";
- return true;
- } else {
- echo "fail ... ";
- echo "Connected has be stopped!!";
- return false;
- }
- }
- ftp_close($conn_id);
- ?>
- <?php
- // assuming file.zip is in the same directory as the executing script.
- $file = 'photos.txt.zip';
- // get the absolute path to $file
- $path = pathinfo(realpath($file), PATHINFO_DIRNAME);
- $zip = new ZipArchive;
- $res = $zip->open($file);
- if ($res === TRUE) {
- // extract it to the path we determined above
- $zip->extractTo($path);
- $zip->close();
- echo " $file extracted to $path";
- } else {
- echo "Couldn't open $file";
- }
- ?>
- header("Content-Type: text/html; charset=UTF-8");
- $lines = file("photos.txt");
- $dir = "localpathtofile";
- foreach ($lines as $line) {
- $parts = explode("t", $line);
- $something = $parts[1];
- $somethingelse = $parts[0];
- $var1 = $ftp_server.$something;
- file_put_contents($dir, file_get_contents($var1));
- }
Add Comment
Please, Sign In to add comment