Skip to content

Instantly share code, notes, and snippets.

@Rudis1261
Created May 16, 2016 20:46
Show Gist options
  • Save Rudis1261/180c43c609aa2a3ec5f6dfcf186725f5 to your computer and use it in GitHub Desktop.
Save Rudis1261/180c43c609aa2a3ec5f6dfcf186725f5 to your computer and use it in GitHub Desktop.
Simple PHP Puller
<?php
ini_set('display_errors', 1);
error_reporting(-1);
$lines = explode(PHP_EOL, file_get_contents('source.txt'));
$dir = 'vids';
if (!file_exists($dir)) {
mkdir($dir);
}
foreach($lines as $num => $line) {
$ext = pathinfo($line, PATHINFO_EXTENSION);
$name = pathinfo($line, PATHINFO_FILENAME);
$read = file_get_contents($line);
if (!$read) {
continue;
}
echo "Saving {$dir}/{$name}.{$ext}" . PHP_EOL;
file_put_contents($dir."/".$name.".".$ext, $read);
}
http://i.imgur.com/cDRMrMy.jpg
http://i.imgur.com/f3gQupR.jpg
http://i.imgur.com/034nlWW.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment