<?php
$data = array ( "name" => 'test_name' , "content" => 'test_con' );
$data = http_build_query( $data );
$opts = array (
'http' => array (
'method' => "POST" ,
'header' => "Content-type: application/x-www-form-urlencoded\r\n" .
"Content-length:" . strlen ( $data ). "\r\n" .
"Cookie: foo=bar\r\n" .
"\r\n" ,
'content' => $data ,
)
);
$cxContext = stream_context_create( $opts );
$sFile = file_get_contents ( "http://127.0.0.1/reponse.php" , false, $cxContext );
echo $sFile ;
?>
// 结果
string(132) "array(2) { ["content"]=> string(8) "test_con" ["name"]=> string(9) "test_name" } array(1) { ["foo"]=> string(3) "bar" } "
Last modification:July 11th, 2022 at 09:49 am
© 允许规范转载
This is my first time i visit here and I found so many interesting stuff in your blog especially it's discussion, thank you. Visit Our Website: https://jujuhatworld.com/
博主好久没更新了,快快更新啊