- <?php
- function Post($url, $post = null)
- {
- $context = array();
- if (is_array($post))
- {
- ksort($post);
- $context['http'] = array
- (
- 'method' => 'POST',
- 'content' => http_build_query($post, '', '&'),
- );
- }
- return file_get_contents($url, false, stream_context_create($context));
- }
- $data = array
- (
- 'name' => 'test',
- 'email' => 'test@gmail.com',
- 'submit' => 'submit',
- );
- echo Post('http://localhost/5-5/request_post_result.php', $data);
- ?>
php post数据到远程
最新推荐文章于 2021-03-12 00:27:19 发布