PHP 请求转发(CURL)
来源:互联网 发布:云端软件 编辑:程序博客网 时间:2024/05/29 19:27
- <?php
- function get_url_content($url){
- $user_agent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)";
- $ch = curl_init();
- //curl_setopt ($ch, CURLOPT_PROXY, $proxy);
- curl_setopt ($ch, CURLOPT_URL, $url);//设置要访问的IP
- curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent);//模拟用户使用的浏览器
- @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1 ); // 使用自动跳转
- curl_setopt ($ch, CURLOPT_TIMEOUT, 60); //设置超时时间
- curl_setopt ($ch, CURLOPT_AUTOREFERER, 1 ); // 自动设置Referer
- curl_setopt ($ch, CURLOPT_COOKIEJAR, 'c:\cookie.txt');
- curl_setopt ($ch, CURLOPT_HEADER,0); //显示返回的HEAD区域的内容
- curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt ($ch, CURLOPT_TIMEOUT, 10);
- $result = curl_exec($ch);
- curl_close($ch);
- return $result;
- }
- print_r(get_url_content('http://www.baidu.com'));
- ?>
- 本文转载自:http://blog.csdn.net/cuiweijie3/article/details/10113977
0 0
- PHP 请求转发(CURL)
- php curl请求转发
- PHP中实现请求转发(curl)和请求重定向
- 转发的 php curl 使用
- PHP - CURL 模拟请求
- PHP CURL 发送请求
- php curl请求
- php curl 批量请求
- PHP curl请求https
- php curl 请求
- php curl 接口请求
- PHP CURL 模拟请求
- PHP页面合成+请求转发
- PHP CURL发送POST请求
- php curl携带 cookie 请求
- php通过curl请求api
- PHP 的curl 请求https
- php curl 请求方法封装
- c#---List共享空间的情况
- wrap_content和match_parent/fill_parent
- MFC-文件对话框
- 单例模式-java描述
- 刷题第一天:南邮NOJ完美立方
- PHP 请求转发(CURL)
- Storm在zookeeper上的目录结构
- 18--26 面向对象程序设计25(继承的三种方式)
- 虚拟游戏世界实体分析
- 日有所长.3 sprite裁剪
- Intent
- 八数码问题有解的条件及其推广
- redis 和 common pool Java Jar 下载地址
- android中AlertDialog-Builder模式