飞豹游侠
高级会员

超高级会员
UID 27267
精华
0
积分 762
帖子 1033
金钱 762 喜悦币
威望 0
人脉 0
阅读权限 50
注册 2004-3-26 来自 沈阳
状态 离线
|
[推荐阅读] 为什么装pear时go-pear.bat提示没有文件扩展名?
<?php function getCookieUrl($host_url, $script_name, $method = 'GET', $data = '', $cookie_str = '') { $sock = fsockopen($host_url, 80, $errno, $errstr, 30); if (!$sock) die("$errstr ($errno)n"); $method = strToUpper($method); $method = ($method == 'GET') ? 'GET' : 'POST'; if (substr($script_name, 0, 1) != '/') { $script_name = '/' . $script_name; }
fwrite($sock, $method . " " . $script_name . " HTTP/1.0rn"); fwrite($sock, "Host: " . $host_url . "rn"); if (!empty($cookie_str)) { fwrite($sock, "COOKIE: " . $cookie_str . "rn"); } fwrite($sock, "Content-type: application/x-www-form-urlencodedrn"); if (!empty($data)) { fwrite($sock, "Content-length: " . strlen($data) . "rn"); } fwrite($sock, "Accept: */*rn"); fwrite($sock, "rn"); if (!empty($data)) { fwrite($sock, "$datarn"); } fwrite($sock, "rn");
$body = ""; while (!feof($sock)) { $body .= fgets($sock, 4096); } fclose($sock); return $body;
} ?> 简单的:
<?php $host_url = 'localhost';
$data = 'test=你好&vvv=ddfda&list=颉 二磷酸腺苷';//类似get的传值,但是这个可以传大量的数据,可以把test=这个等于号后面的值,用变量传进来. $data = 'test=' . $title . '&...
$sock = fsockopen($host_url, 80, $errno, $errstr, 30); if (!$sock) die("$errstr ($errno)n");
fwrite($sock, "POST /p.php HTTP/1.0rn"); fwrite($sock, "Host: " . $host_url . "rn"); fwrite($sock, "Content-type: application/x-www-form-urlencodedrn"); fwrite($sock, "Content-length: " . strlen($data) . "rn"); fwrite($sock, "Accept: */*rn"); fwrite($sock, "rn"); fwrite($sock, "$datarn"); fwrite($sock, "rn");
$body = ""; while (!feof($sock)) { $body .= fgets($sock, 4096); } fclose($sock); echo $body; ?>
|  我发现我越来越菜,怎么办啊...
龙之剑,深圳民间反扒队,欢迎加入 |
|