mardi 3 juillet 2018

Get the Zip file by URL in PHP

I am getting the response by Third party API call. They providing me a file_url in response. If I hitting the file_url in browser URL got the zip file on local machine.

stdClass Object
(
    [start_date] => 2018-06-01 08:00:00
    [report_date] => 2018-07-02
    [account_name] => Maneesh
    [show_headers] => 1
    [file_url] => https:examplefilename
    [date_range] => 06/01/2018 - 07/03/2018
)

How can I download the zip file on public folder on server and unzipped the file?

$fileUrl = $obj->file_url;
$zip = realpath('phoneList/');
file_put_contents($zip, file_get_contents($fileUrl));

I tried above code to save the zip file on public folder but nothing work.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire