[ 永远的UNIX::UNIX技术资料的宝库 ]

首页 > 编程技术 > Php > 正文
PHP源码学习:探测httpheader头!
本文出自:http://php2000.com/~uchinaboy/wdb/wdb.php 作者: uchinaboy (2001-12-01 17:49:10)
<?php /****************************************************  
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();  
?>
 
(http://www.fanqiang.com)
    进入【UNIX论坛

相关文章
 

★  樊强制作 欢迎分享  ★