php的http_build_querystream_context_createpost请求

php的http_build_querystream_context_createpost请求

内容导读

收集整理的这篇技术教程文章主要介绍了php的http_build_querystream_context_createpost请求,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1022字,纯文字阅读大概需要2分钟

内容图文

这篇文章主要介绍了关于php 的http_build_query stream_context_create post请求 ,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下
 1 <?php
2 function send_post($url, $post_data)
3 {
4

 $postdata = http_build_query($post_data);
5

 $options = array(
6



 'http' => array(
7





 'method' => 'POST',
8





 'header' => 'Content-type:application/x-www-form-urlencoded',
9





 'content' => $postdata, 10





 'timeout' => 15 * 60 // 超时时间(单位:s) 11



 ) 12

 ); 13

 $context = stream_context_create($options); 14

 $result = file_get_contents($url, false, $context); 15
16

 echo $result; 17 } 18
19 //使用方法 20 $post_data = array( 21

 'a' => '11', 22

 'b' => '22' 23 ); 24 send_post('http://localhost/b.php', $post_data);

以上就是本文的全部内容,希望对大家的学习有所帮助,更多相关内容请关注PHP中文网!

相关推荐:

PHP7.1中使用openssl替换mcrypt 的介绍

PHP Excel导入数据到MySQL数据库的方法

以上就是php 的http_build_query stream_context_create post请求的详细内容,更多请关注Gxl网其它相关文章!

内容总结

以上是为您收集整理的php的http_build_querystream_context_createpost请求全部内容,希望文章能够帮你解决php的http_build_querystream_context_createpost请求所遇到的程序开发问题。 如果觉得技术教程内容还不错,欢迎将网站推荐给程序员好友。

内容备注

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。


本文关键词:

联系我们

在线咨询:点击这里给我发消息

邮件:w420220301@qq.com