formpostphp
❶ 我想在html form提交数据给 do.php 通过post方式提交,怎么进行 数据的加密,防止抓包! 问题二!
没有抓包软件抓不到的。只有是抓到能不能给抓包软件识别出是不是正常代码而已。例如HTTPS协议,或者加如证书。或者加密了之后再GET,POST。
❷ 怎么用PHP发送POST请求
PHP发送POST请求的三种方式
classRequest{
publicstaticfunctionpost($url,$post_data='',$timeout=5){//curl
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,1);
if($post_data!=''){
curl_setopt($ch,CURLOPT_POSTFIELDS,$post_data);
}
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
curl_setopt($ch,CURLOPT_HEADER,false);
$file_contents=curl_exec($ch);
curl_close($ch);
return$file_contents;
}
publicstaticfunctionpost2($url,$data){//file_get_content$postdata=http_build_query(
$data
);$opts=array('http'=>
array(
'method'=>'POST',
'header'=>'Content-type:application/x-www-form-urlencoded',
'content'=>$postdata
)
);$context=stream_context_create($opts);
$result=file_get_contents($url,false,$context);
return$result;
}
publicstaticfunctionpost3($host,$path,$query,$others=''){//fsocket
$post="POST$pathHTTP/1.1 Host:$host ";
$post.="Content-type:application/x-www-form-";
$post.="urlencoded ${others}";
$post.="User-Agent:Mozilla4.0 Content-length:";
$post.=strlen($query)." Connection:close $query";
$h=fsockopen($host,80);
fwrite($h,$post);
for($a=0,$r='';!$a;){
$b=fread($h,8192);
$r.=$b;
$a=(($b=='')?1:0);
}
fclose($h);
return$r;
}
}
http://www.oschina.net/code/snippet_729516_33065
❸ php form表单如何post获取checkbox值,放入到数据库里
哇,我刚做这个,checkbox是数组你要把他们放在数组里面
原理就是:把那几个值传过来。再把他们转成非数组
比如:
<input type="checkbox" name="waistline[]" value="29" />29
<input type="checkbox" name="waistline[]" value="30" />30
<input type="checkbox" name="waistline[]" value="31" />31
<input type="checkbox" name="waistline[]" value="32" />32
这几个表单
$waistline=$_POST["waistline"];
$myallsport = implode (",", $waistline);
这样insert的时候 就把$myallsport 这个插入到里面就O了
❹ PHP中的POST,求大虾详细解释
<form method="POST" 这行说明你的提交方式为 POST
action="post.php?action=post" 但这个提交地址,action=post 却是GET方式提交的,所以要接这个action 必须是 $_GET['action'];
但表单里的其它项,就要用$_POST['表单项'] 来接收了