header 请求类型不一样哦 根据自己情况 修改
function send_post($url, $post_data) { //$postdata = http_build_query($post_data); $postdata = json_encode($post_data); // print_r($postdata);die; $options = array( 'http' => array( 'method' => 'POST', 'header' => 'Content-type:application/json; charset=utf-8', //
//application/x-www.form-urlencoded'content' => $postdata, 'timeout' => 15 * 60 // 超时时间(单位:s) ) ); $context = stream_context_create($options); $result = file_get_contents($url, false, $context); return $result; }
PHPpost 请求
最新推荐文章于 2022-10-09 11:18:55 发布