美文网首页
表单模拟

表单模拟

作者: liamu | 来源:发表于2017-07-04 14:08 被阅读9次
    <?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);
    ?>
    

    相关文章

      网友评论

          本文标题:表单模拟

          本文链接:https://www.haomeiwen.com/subject/feozcxtx.html