From dfc36bb38f98faf38f444798f5631e174b5dce50 Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Mon, 12 Sep 2016 00:33:07 -0700 Subject: [PATCH] Add download file with redirection example --- examples/download_file_with_redirect.php | 13 +++++++++++++ examples/progress.php | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 examples/download_file_with_redirect.php diff --git a/examples/download_file_with_redirect.php b/examples/download_file_with_redirect.php new file mode 100644 index 0000000..52618e6 --- /dev/null +++ b/examples/download_file_with_redirect.php @@ -0,0 +1,13 @@ +setOpt(CURLOPT_FOLLOWLOCATION, true); +$curl->download($start_url, '/tmp/php-med-trans.png'); + +assert($final_url === $curl->effectiveUrl); diff --git a/examples/progress.php b/examples/progress.php index f51ef4b..d2a5f47 100644 --- a/examples/progress.php +++ b/examples/progress.php @@ -12,4 +12,4 @@ $curl->progress(function ($client, $download_size, $downloaded, $upload_size, $u $percent = floor($downloaded * 100 / $download_size); echo ' ' . $percent . '%' . "\r"; }); -$curl->download('https://php.net/distributions/manual/php_manual_en.html.gz', '/tmp/php_manual_en.html.gz'); +$curl->download('https://secure.php.net/distributions/manual/php_manual_en.html.gz', '/tmp/php_manual_en.html.gz');