-
无状态协议
查看全部 -
http协议
查看全部 -
post模拟提交所需的格式
查看全部 -
http防盗链,.htaccess
查看全部 -
开启重写引擎;
重写条件是:
满足条件后,重写规则为:
查看全部 -
$postData = array(
'action' => 'req',
'type' => 'post'
);
$postData = http_build_query($postData);
$fp = fsockopen('localhost', 80, $errno, $errorStr, 5);
$reqData = "POST /reg.php HTTP/1.1\r\n";
$reqData .= "HOST:localhost\r\n";
$reqData .= "Content-type:application/x-www-form-urlencoded\r\n";
$reqData .= "Content-length:" . strlen($postData) . "\r\n\r\n";
fwrite($fp, $reqData);
while(!feof($fp)) {
echo fgets($fp, 1024) . '.Hello World\r\n';
}
fclose($fp);
exit;
服务端echo粗来,but报错500
查看全部 -
$postData = array(
'action' => 'req',
'type' => 'post'
);
$handle = curl_init();
$url = 'http://127.0.0.1/reg.php';
curl_setopt($handle, CURLOPT_URL, $url);
curl_setopt($handle, CURLOPT_POST, 1);
curl_setopt($handle, CURLOPT_POSTFIELDS, $postData);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1);//返回数据为字符串
$response = curl_exec($handle);
curl_close($handle);
echo $response;exit;
查看全部 -
fopen(filename,mode,include_path,context)
fopen() 将 filename 指定的名字资源绑定到一个流上。如果 filename 是 "scheme://..." 的格式,则被当成一个 URL,PHP 将搜索协议处理器(也被称为封装协议)来处理此模式。如果该协议尚未注册封装协议,PHP 将发出一条消息来帮助检查脚本中潜在的问题并将 filename 当成一个普通的文件名继续执行下去。
查看全部 -
<?php
$postData = array(
'action' => 'req',
'type' => 'post'
);
$postData = http_build_query($postData);
$ops = array(
'http' => array(
'method' => 'POST',
'header' => "Host:localhost\r\nContent-type:application/x-www-form-urlencoded\r\nContent-length:" . strlen($postData)."\r\n",
'timeout' => 60,
'content' => $postData
),
);
$context = stream_context_create($ops);
echo file_get_contents('http://127.0.0.1/reg.php', false, $context);
exit;
//注意file_get_contents的链接里必须加http://
?>
查看全部 -
POST /reg.php HTTP/1.1
Host:localhost
Content-type:application/x-www-form-urlencoded
Content-length:20
type=post&act=reg
上边一坨得一起复制,一行行来直接就访问服务器了
查看全部 -

查看全部 -
http协议源于信息共享
查看全部 -
无状态协议
查看全部 -


查看全部 -
http 是无状态协议 每次请求完成后 请求自动断开 下次请求时 需要从新请求
查看全部
举报