使用file_get_contents发送post请求 2017年11月21日 | php | 阅读 文章目录 , 75 words 使用file_get_contents发送post请求 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 <?php $requestBody = '{"username":"josh"}'; $context = stream_context_create( array( 'http' => array( 'method' => 'POST', 'header' => 'Content-Type:application/json;charset=utf-8;\r\n' . 'Content-Length: ' . mb_strlen($requestBody), 'content' => $requestBody , ) ) ); $response = file_get_contents($url,false,$context); 原文作者:zhenxing 原文链接:https://www.zhenxing.site/post/file_get_content/ 版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议进行许可,非商业转载请注明出处(作者,原文链接),商业转载请联系作者获得授权。 See Also php中使用curl发送http请求 Vim移动行 一些比较有用的工具网站 归档 搜索 php