表单模拟

 '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);
?>

你可能感兴趣的:(表单模拟)