脚本宝典收集整理的这篇文章主要介绍了php利用fsockopen GET/POST提交表单及上传文件,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
PHP利用fsockopen GET/POST提交表单及上传文件,具体内容如下
get.PHP
<PRe class="brush:PHp;">$param = array(
'name' => 'fdipzone','gender' => 'man'
);
$url = $url.'?'.http_build_query($param);
// create connect
$fp = fsockoPEn($host,$port,$errno,$errstr,$timeout);
if(!$fp){
return false;
}
// send request
$out = "GET ${url} HTTP/1.1\r\n";
$out .= "Host: ${host}\r\n";
$out .= "Connection:close\r\n\r\n";
fputs($fp,$out);
// get response
$response = '';
while($row=fread($fp,4096)){
$response .= $row;
}
fclose($fp);
$pos = strpos($response,"\r\n\r\n");
$response = substr($response,$pos+4);
echo $response;
?>
以上是脚本宝典为你收集整理的php利用fsockopen GET/POST提交表单及上传文件全部内容,希望文章能够帮你解决php利用fsockopen GET/POST提交表单及上传文件所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。