<?php
$postData = array(
'title' => 'title1',
'message' => 'message2',
// title=sdf&message=%09%09%0D%0A%09%09dfdfdf%09%09&%E6%8F%90%E4%BA%A4=%E6%8F%90%E4%BA%A4
// '提交' =>
);
$postData = http_build_query($postData);
$opt = array(
'http'=>array(
'method'=>'POST',
'header'=> "Host:localhost\r\n".
"Content-Type: application/x-www-form-urlencoded\r\n".
"Content-length:".strlen($postData)."\r\n",
'content' => $postData,
)
);
$context = stream_context_create($opt);
// file_get_contents("http://localhost/lpost.php",false,$context);
$fp = fopen('http://localhost/lpost.php','r',false,$context);
// fclose($fp);
?>
表单模拟
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 需要模拟的就是上面form表单。 正文的开始 curl_setop设置选项 PS:上面例子只有在php5以下版本有...
- 原文地址:→看过来 写在前面 select 是HTML表单元素中很常用的一个,其中很重要的几个属性常被忽略,但这几...