Home > php教程 > php手册 > PHP源码学习:探测httpheader头

PHP源码学习:探测httpheader头

WBOY
Release: 2016-06-21 08:58:37
Original
1339 people have browsed it
program : Spr2[detect_httpheader]  
Author  : uchinaboy   
E-mail  : uchinaboy@163.com  
QQ      : 16863798  
Date    : 2001-7-25 
****************************************************/ 
$host = "www.infojet.com.cn"; 
$port = "80"; $path = "/yuhu/"; 
$filename = "talk0.asp"; 
$datestream = "sdjahsdjkhaksjd"; 
$length = strlen($datestream); 
$header = "POST ${ path}$filename HTTP/1.1\n"; 
$header.= "HOST: $host\n"; 
$header.= "Content-Type: application/x-www-form-urlencoded\n"; 
$header.= "Content-Length: $length\n\n"; 
$header.= "$datestream"; 
function sock() {  global $host, $port, $header; 
$fsocket = @fsockopen($host, $port, &$errno, &$errstr); 
if(!$fsocket) {  echo "$errstr ($errno)\n"; }else {  fputs($fsocket, $header); 
while(!feof($fsocket)) {  
$res = fread($fsocket, 128); 
echo $res; } 

fclose($fsocket); 

set_time_limit(0); 
sock();  
?>



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template