You can use PHP's copy() function or file_get_contents() and file_put_contents() functions or curl library to download file.
Here is some example for you :
COPY FUNCTION
- $file = "http://example.com/file.html";
- copy($file,"eshan.html");
file_get_contents and file_fut_contents
- $file = "http://example.com/file.html";
- $file_data = file_get_contents($file);
- file_put_contents("eshan.html",$file_data)
CURL
- $ch = curl_init($file);
- curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
- curl_setopt($ch,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
- $data = curl_exec($ch);
- $fp = fopen("dpt.php","w");
- fwrite($fp,$data);