Jump to content

Downloading from another server(txt file).


DeathStar

Recommended Posts

create a php file that the cron runs either with a browser link lynx or someway similiar.

 

<?php
$contents = file_get_contents($filetoget);

$date = date('Y-m-d-h-i-s', time());
$date = $date . rand(1,100000000); // randomize the number
$fp = fopen($date, 'w+'); // writing create file if nto exists.
fwrite($fp, $contents);
fclose($fp);
?>

 

Than just have the cron job run that file via lynx or however you wanna do it.

Thankyou alot.

<?php
$filetoget = 'http://web.com/file.txt';
$contents = file_get_contents($filetoget);

$dname = 'tribes.txt'; // randomize the number
$fp = fopen($name, 'w+'); // writing create file if nto exists.
fwrite($fp, $contents);
fclose($fp);
$size = filesize('tribes.txt');
echo $size.'bytes retrived.';
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.