php带cookie访问下载文件 header设置

<?php
header("Content-type: text/html");
$url = "http://localhost/ge/phpclass/testdown.php";
 
 
 $header = array("Host:java-er.com",
        'Content-Type:application/x-www-form-urlencoded',
        'Cookie:PHPSESSID=7tjquhlqftltvjeq7tkd4nr0b1',
        'SocketLog:SocketLog(tabid=121&client_id=ADMIN_ADMIN)',
        'User-Agent: Mozilla/4.0 (compatible; MSIE .0; Windows NT 6.1; Trident/4.0; SLCC2;)'); 
 
$r = Http::request($url, $params, $method, $multi, $header);
echo $r;
?>

testdown.php文件的源码

<?php
 
 
	var_dump($_SERVER)
?>
array(31) {
  ["UNIQUE_ID"]=>
  string(24) "W6xlVMCoAWgAAAh7fwIAAAAA"
  ["HTTP_ACCEPT"]=>
  string(3) "*/*"
  ["HTTP_HOST"]=>
  string(11) "java-er.com"
  ["CONTENT_TYPE"]=>
  string(33) "application/x-www-form-urlencoded"
  ["HTTP_COOKIE"]=>
  string(36) "PHPSESSID=7tjquhlqftltvjeq7tkd4nr0b1"
  ["HTTP_SOCKETLOG"]=>
  string(42) "SocketLog(tabid=121&client_id=ADMIN_ADMIN)"
  ["HTTP_USER_AGENT"]=>
  string(70) "Mozilla/4.0 (compatible; MSIE .0; Windows NT 6.1; Trident/4.0; SLCC2;)"
  ["PATH"]=>
  string(29) "/usr/bin:/bin:/usr/sbin:/sbin"
  ["DYLD_LIBRARY_PATH"]=>
  string(34) "/Applications/XAMPP/xamppfiles/lib"
  ["SERVER_SIGNATURE"]=>
  string(0) ""
  ["SERVER_SOFTWARE"]=>
  string(76) "Apache/2.4.7 (Unix) PHP/5.5.9 OpenSSL/1.0.1f mod_perl/2.0.8-dev Perl/v5.16.3"
  ["SERVER_NAME"]=>
  string(11) "java-er.com"
  ["SERVER_ADDR"]=>
  string(9) "127.0.0.1"
  ["SERVER_PORT"]=>
  string(2) "80"
  ["REMOTE_ADDR"]=>
  string(9) "127.0.0.1"
  ["DOCUMENT_ROOT"]=>
  string(20) "/Users/ge/ge/web/php"
  ["REQUEST_SCHEME"]=>
  string(4) "http"
  ["CONTEXT_PREFIX"]=>
  string(0) ""
  ["CONTEXT_DOCUMENT_ROOT"]=>
  string(20) "/Users/ge/ge/web/php"
  ["SERVER_ADMIN"]=>
  string(32) "webmaster@dummy-host.example.com"
  ["SCRIPT_FILENAME"]=>
  string(45) "/Users/ge/ge/web/php/ge/phpclass/testdown.php"
  ["REMOTE_PORT"]=>
  string(5) "56361"
  ["GATEWAY_INTERFACE"]=>
  string(7) "CGI/1.1"
  ["SERVER_PROTOCOL"]=>
  string(8) "HTTP/1.1"
  ["REQUEST_METHOD"]=>
  string(3) "GET"
  ["QUERY_STRING"]=>
  string(0) ""
  ["REQUEST_URI"]=>
  string(25) "/ge/phpclass/testdown.php"
  ["SCRIPT_NAME"]=>
  string(25) "/ge/phpclass/testdown.php"
  ["PHP_SELF"]=>
  string(25) "/ge/phpclass/testdown.php"
  ["REQUEST_TIME_FLOAT"]=>
  float(1538024788.402)
  ["REQUEST_TIME"]=>
  int(1538024788)
}


This entry was posted in PHP and tagged , , . Bookmark the permalink.
月小升QQ 2651044202, 技术交流QQ群 178491360
首发地址:月小升博客https://java-er.com/blog/php-header/
无特殊说明,文章均为月小升原创,欢迎转载,转载请注明本文地址,谢谢
您的评论是我写作的动力

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

*

  

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

About Me

静水流深,水滴石穿