跨域访问PHP代理解决方案
来源:互联网 发布:网络教育有研究生 编辑:程序博客网 时间:2024/04/29 20:31
示例说明:
其中:http://203.156.244.227:80/cgi-bin/get_score.fcgi为要代理的URL,参数为content正文内容。
GET方法代理:
<?php$searchUrl = 'http://203.156.244.227:80/cgi-bin/get_score.fcgi?content=';if(!empty($_GET['content'])){$searchUrl .= $_GET['content'];}echo file_get_contents($searchUrl);?>
POST方法代理:
<?php$post_string = "content=".$_POST['content'];echo request_by_post('http://203.156.244.227:80/cgi-bin/get_score.fcgi',$post_string);function request_by_post($remote_server,$post_string){$context = array('http'=>array('method'=>'POST','header'=>'Content-type: application/x-www-form-urlencoded'."\r\n".'User-Agent : Firstboy\'s POST Example beta'."\r\n".'Content-length: '.strlen($post_string)+1,'content'=> $post_string));$stream_context = stream_context_create($context);$data = file_get_contents($remote_server,FALSE,$stream_context);return $data;}?>
- 跨域访问PHP代理解决方案
- 跨域访问解决方案
- 跨域解决方案 ajax代理
- ajax跨域访问代理文件下载(asp、php、asp.net)
- Javascript跨域访问解决方案
- Flex 跨域访问解决方案
- Javascript跨域访问解决方案
- Javascript跨域访问解决方案
- Javascript跨域访问解决方案
- Javascript跨域访问解决方案
- Javascript跨域访问解决方案
- Javascript跨域访问解决方案
- Uploadify跨域访问解决方案
- jquery跨域访问解决方案
- Ajax跨域访问解决方案
- Javascript跨域访问解决方案
- Javascript跨域访问解决方案
- Javascript跨域访问解决方案
- qmail启动报错日志 alert: cannot start: unable to open mutex
- 1.6.1 3n+1问题 UVA100
- 你所不知道的五件事情:当心可变性
- 当CMOS遇上TTL
- 没有心情听音乐
- 跨域访问PHP代理解决方案
- .net Framwork安装后,IIS重置
- 设计模式之Decorator
- c/c++实现遍历文件夹下特定的文件
- Android 数字签名
- 左岸摘抄之2
- C++函数重定义、重载、重写
- 开发资源集锦
- 用C++实现半透明按钮控件(PNG,GDI+)