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);
中级程序员
by: 鲨鱼 发表于:2015-10-23 18:00:34 顶(0) | 踩(0) 回复
还是 curl POST 发送好些。
回复评论