Answers for "php get file from server"

PHP
8

php get file contents

<?php
file_get_contents("file.txt");
?>
Posted by: Guest on May-12-2020
0

php get file from another server

<?php
    $url  = 'http://www.example.com/a-large-file.zip';
    $path = '/path-to-file/a-large-file.zip';

    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    $data = curl_exec($ch);

    curl_close($ch);

    file_put_contents($path, $data);
?>
Posted by: Guest on November-16-2020

Browse Popular Code Answers by Language