<?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
<?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) }