php get file from another server

Solutions on MaxInterview for php get file from another server by the best coders in the world

showing results for - "php get file from another server"
Lorenzo
08 Feb 2018
1<?php
2    $url  = 'http://www.example.com/a-large-file.zip';
3    $path = '/path-to-file/a-large-file.zip';
4
5    $ch = curl_init($url);
6    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
7
8    $data = curl_exec($ch);
9
10    curl_close($ch);
11
12    file_put_contents($path, $data);
13?>
14