mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-10-08 13:05:30 +00:00
Fix #98: Implement download() method
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
<?php
|
||||
require 'Helper.php';
|
||||
|
||||
use \Helper\Test;
|
||||
|
||||
$http_raw_post_data = file_get_contents('php://input');
|
||||
$_PUT = array();
|
||||
$_PATCH = array();
|
||||
@@ -117,6 +121,14 @@ if ($test == 'http_basic_auth') {
|
||||
$rss->appendChild($channel);
|
||||
echo $doc->saveXML();
|
||||
exit;
|
||||
} elseif ($test === 'download_response') {
|
||||
$png = Helper\create_png();
|
||||
header('Content-Type: image/png');
|
||||
header('Content-Disposition: attachment; filename="image.png"');
|
||||
header('Content-Length: ' . strlen($png));
|
||||
header('ETag: ' . md5($png));
|
||||
echo $png;
|
||||
exit;
|
||||
} elseif ($test === 'error_message') {
|
||||
if (function_exists('http_response_code')) {
|
||||
http_response_code(401);
|
||||
|
||||
Reference in New Issue
Block a user