喜悦国际村 
» 游客:  注册 | 登录 | 搜索 | 统计 | 喜悦证交所 | 帮助

RSS 订阅当前论坛  

[北京]代朋友公司招聘PHP高级程序员多名

上一主题 下一主题
     
标题: [问题] 如何读取网页的内容  
 
resonru (resonru)
注册会员
Rank: 2
初级会员



UID 67667
精华 0
积分 73
帖子 56
金钱 73 喜悦币
威望 0
人脉 0
阅读权限 20
注册 2006-1-1
状态 离线
如何读取网页的内容

我想读取一个网页的内容!需要登录以后才能可以显示的网页?
请大家指点!我该怎么办!如果知道的话!具体的!谢谢!我是菜鸟!
2008-7-15 02:12 PM#1
查看资料  访问主页  发短消息  顶部
 
游戏人间
版主
Rank: 7Rank: 7Rank: 7
☞风云山庄大少爷☜


UID 62639
精华 2
积分 14485
帖子 7405
金钱 14338 喜悦币
威望 20
人脉 127
阅读权限 100
注册 2004-12-21
来自 广西人在北京
状态 离线
[推荐阅读] 关于递归运算的形态与表现方式
据说要模拟post之类的,找个模拟post的方法之后就好办了.没干过这事.



 
群号:6025396/6025252/19520091(广西PHP交流/PHP高级编程/算法交流) 寧可在嘗試中失敗,也不在保守中成功! 不為失敗找理由,只為成功找方法! 饿踢Blog
 
2008-7-15 02:41 PM#2
查看资料  访问主页  Blog  发短消息  顶部
 
znznzn333
注册会员
Rank: 2



UID 112524
精华 0
积分 116
帖子 79
金钱 116 喜悦币
威望 0
人脉 0
阅读权限 20
注册 2008-3-3
状态 离线
[推荐阅读] 关于递归运算的形态与表现方式
这个还真不知道.
可能看网页传值是什么直接传用户名密码到那个页面就能读取了吧
2008-7-15 02:47 PM#3
查看资料  访问主页  Blog  发短消息  顶部
 
jianghuluanke
新手上路
Rank: 1



UID 130976
精华 0
积分 26
帖子 24
金钱 26 喜悦币
威望 0
人脉 0
阅读权限 10
注册 2008-7-1
状态 离线
[推荐阅读] 头疼的EXT下拉多选树问题,请进来指点一下,谢谢?
这个没有用的,对方既然这样设置了,那肯定得登录再看了!



源码、编程书籍下载
2008-7-15 03:35 PM#4
查看资料  访问主页  发短消息  顶部
 
guog
论坛元老
Rank: 8Rank: 8



UID 79936
精华 0
积分 9709
帖子 416
金钱 9709 喜悦币
威望 0
人脉 0
阅读权限 90
注册 2006-9-12
来自 北京
状态 在线
[推荐阅读] 会的帮忙看看,谢谢!
不理解你的意思,如果是没帐号只有去注册个帐号先,如果不开放注册,只有去盗个或攻陷它的服务器。如果是有帐号想抓内容,建议用curl
<?php
class cURL {
  /*
  * @author Keith Kurson (delusions@gmail.com)
  * @date September 09, 2006
  * @version 1.0
  */
     /*
     * Headers
     */
     var $headers;
     /*
     * User Agent
     */
     var $user_agent;
     /*
     * Compression
     */
     var $compression;
     /*
     * Cookie File
     */
     var $cookie_file;
     /*
     * Proxy Server
     * ip:port
     */
     var $proxy;
     /*
     * Initiate the class
     */
     function cURL($cookies=TRUE,$cookie='cookies.txt',$compression='gzip',$proxy='') {
           $this->headers[] = "Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg";
           $this->headers[] = "Connection: Keep-Alive";
           $this->headers[] = "Content-type: application/x-www-form-urlencoded";
           $this->user_agent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)";
           $this->compression=$compression;
           $this->proxy=$proxy;
           $this->cookies=$cookies;
           if ($this->cookies == TRUE) $this->cookie($cookie);
     }
     /*
     * Tests the Cookie File
     */
     function cookie($cookie_file) {
          if (file_exists($cookie_file)) {
                $this->cookie_file=$cookie_file;
          } else {
                @fopen($cookie_file,'w') or $this->error("The cookie file could not be opened. Make sure this directory has the correct permissions");
                $this->cookie_file=$cookie_file;
                fclose($cookie_file);
          }
     }
     /*
     * Runs a GET through cURL
     */
     function get($url,$refer='') {
          $process = curl_init($url);
          curl_setopt($process, CURLOPT_REFERER, $refer);
          curl_setopt($process, CURLOPT_HTTPHEADER, $this->headers);
          curl_setopt($process, CURLOPT_USERAGENT, $this->user_agent);
          if ($this->cookies == TRUE) curl_setopt($process, CURLOPT_COOKIEFILE, $this->cookie_file);
          if ($this->cookies == TRUE) curl_setopt($process, CURLOPT_COOKIEJAR, $this->cookie_file);
          curl_setopt($process,CURLOPT_ENCODING , $this->compression);
          curl_setopt($process, CURLOPT_TIMEOUT, 30);
          if ($this->proxy) curl_setopt($cUrl, CURLOPT_PROXY, 'proxy_ip:proxy_port');
          curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
          $return = curl_exec($process);
          curl_close($process);
          return $return;
     }
     /*
     * Runs a POST through cURL
     */
     function post($url,$data,$refer) {
          $process = curl_init($url);
          curl_setopt($process, CURLOPT_REFERER, $refer);
          curl_setopt($process, CURLOPT_HTTPHEADER, $this->headers);
          curl_setopt($process, CURLOPT_USERAGENT, $this->user_agent);
          if ($this->cookies == TRUE) curl_setopt($process, CURLOPT_COOKIEFILE, $this->cookie_file);
          if ($this->cookies == TRUE) curl_setopt($process, CURLOPT_COOKIEJAR, $this->cookie_file);
          curl_setopt($process, CURLOPT_ENCODING , $this->compression);
          curl_setopt($process, CURLOPT_TIMEOUT, 30);
          if ($this->proxy) curl_setopt($cUrl, CURLOPT_PROXY, 'proxy_ip:proxy_port');
          curl_setopt($process, CURLOPT_POSTFIELDS, $data);
          curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
          curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
          curl_setopt($process, CURLOPT_POST, 1);
          $return = curl_exec($process);
          curl_close($process);
          return $return;
     }
     /*
     * Error Output
     */
     function error($error) {
          echo "<center><div style='width:500px;border: 3px solid #FFEEFF; padding: 3px; background-color: #FFDDFF;font-family: verdana; font-size: 10px'><b>cURL Error</b><br>$error</div></center>";
          die;
     }
}
?>




没有
2008-7-15 03:39 PM#5
查看资料  Blog  发短消息  顶部
     


  可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题 | 开通个人空间  


 




Powered by Discuz! 6.1.0  © 2001-2010 Comsenz Inc.
Processed in 0.026375 second(s), 6 queries

(冀ICP备05009913号) 管理员:sadly 邮箱/MSN: sadly@phpx.com QQ:824008(长隐) 清除 Cookies - - Archiver - WAP