[PHP] file_get_contents post 发送 →→→→→进入此内容的聊天室

来自 , 2020-09-18, 写在 PHP, 查看 153 次.
URL http://www.code666.cn/view/a4fa7175
  1. function post($url, $post = null)  
  2. {  
  3.     $context = array();  
  4.  
  5.     if (is_array($post))  
  6.     {  
  7.         ksort($post);  
  8.  
  9.         $context['http'] = array  
  10.         (  
  11.             'method' => 'post',  
  12.             'content' => http_build_query($post, '', '&'),  
  13.         );  
  14.     }  
  15.  
  16.     return file_get_contents($url, false, stream_context_create($context));  
  17. }  
  18.  
  19. $data = array  
  20. (  
  21.     'name' => 'test',  
  22.     'email' => 'test@gmail.com',  
  23.     'submit' => 'submit',  
  24. );  
  25.  
  26. echo post('http://localhost/5-5/request_post_result.php', $data);

回复 "file_get_contents post 发送"

这儿你可以回复上面这条便签

captcha