Copy file from remote server

Use this script to copy a file from a remote server and save on your own server.



<?php
$feed = "http://www.domain.com/thefile.pdf";// url to original

$copydir = "/home/webdev/public_html/copies/"; //directory to copy to (CHMOD 777)

$data = file_get_contents($feed);

$file = fopen($copydir . "thefile.pdf", "w+");

fputs($file, $data);

fclose($file);

?>

Tags: , , ,

Leave a Comment

You must be logged in to post a comment.