返回列表 回复 发帖

通过file_get_contents来Post数据的实例

file_get_contents.php: Post数据
  1. <?php  
  2. function Post($url, $post = null)  
  3. {  
  4.     $context = array();  
  5.   
  6.     if (is_array($post))  
  7.     {  
  8.         ksort($post);  
  9.   
  10.          $context['http'] = array  
  11.          (  
  12.              'method' => 'POST',  
  13.              'content' => http_build_query($post, '', '&'),  
  14.          );  
  15.      }  
  16.    
  17.      return file_get_contents($url, false, stream_context_create($context));  
  18. }  
  19.    
  20. $data = array  
  21. (  
  22.      'name' => 'test',  
  23.      'email' => 'test@gmail.com',  
  24.      'submit' => 'submit',  
  25. );  
  26.    
  27. echo Post('http://localhost/5-5/request_post_result.php', $data);  
  28. ?>  
复制代码
request_post_result.php  接收经过Post的数据:
  1. <?php  
  2. echo $_POST['name'];  
  3. echo $_POST['email'];  
  4. echo $_POST['submit'];  
  5. echo "fdfd";  
  6. ?>  
复制代码
Postfix技术专业支持论坛
http://www.thismail.org/bbs
-----------------------------------
提供专业postfix技术支持,邮件系统开发定制
QQ:187159779 注明(Postfix技术支持)
返回列表
开源邮件服务器 开源邮件服务器 web 开源邮件 开源 mail 开源 邮件服务器 邮件技术 mail技术 反垃圾邮件 反垃圾mail mail投递
邮件服务器 mail服务器 开源软件 mail软件 mail服务新品牌 开源邮件服务新品牌
开源mail服务新网站 邮件服务新品牌 mail tmail mailserver 163邮件 sendmail |Linux维护|Linux代维|成都Linux维护|成都Linux代维