可行。详见curl函数。这里是一个例子:
http://community.csdn.net/Expert/TopicView1.asp?id=3299669

解决方案 »

  1.   

    例子:取新浪首页<title>到</title>的内容<?
    $fn=fopen("http://www.sina.com.cn","r");
    $nr=fread($fn,500);
    fclose($fn);
    preg_match("/<title>(.*)<\/title>/",$nr,$nn);
    echo $nn[1];
    ?>
      

  2.   

    回复: yzs1013(阳光雨露)你可以对 www.sohu.com 试试看。
    报错
    Warning: php_hostconnect: connect failed in 但是按道理,我能够在 IE 里访问 web 页面,就应该可以拿到该页面的内容。
    同时也有兴趣研究一下这个问题,但是不知道为什么这些网站的却拿不到。
      

  3.   

    你的第三方web网站(需要用户名、密码登录)指的是什么?
      

  4.   

    to zairwolfi(君子兰) 我研究一下!谢谢!to tod204(八十年代)比如我让程序自动登录邮件服务器的web网站,自动取得里面的邮件列表,这个邮件web网站就是第三方web网站
      

  5.   

    但是如果网站用了session就麻烦了
      

  6.   

    to  syre(神仙) 是啊,就是这个问题,如果它用session怎么办?
      

  7.   

    呵呵,你写个组件,直接socket连接,session读取保存以后,下次访问的时候附加session就可以了
      

  8.   

    如果用户浏览器打开了cookie,那么session的传递是通过cookie的,所以你可以臆造,格式参照http协议,内容就像用flashget下载文件时程序里面的提示内容,以前phpx.com也讨论,可以去搜索看看.
      

  9.   

    to liyujie2000(开心的鱼)
    可能你漏了http:// 
    <%
    $fn=fopen("http://www.sohu.com","r");
    $nr=fread($fn,500);
    fclose($fn);
    preg_match("/<title>(.*)<\/title>/",$nr,$nn);
    echo $nn[1];
    %>
    结果:搜狐首页(我这里访问正常)
      

  10.   

    费话啦必须通过界面验证的东西不可能直接pass
      

  11.   

    用了session或指定了判断访问器类型的文件就无法通过其他方式能正常下载,socket或者curl都不例外
      

  12.   

    主要是验证码问题。其实的都好说。
    楼主的这个意思。其实极像网易通行证这样的东西来着。
    你用HIDDEN来完成。
    虚拟一次登陆,至于他用SESSION和COOKIE都无所谓的。因为服务器接到你虚拟信息后,会以为你已经成功进入 。
    难点在于 abigfrog(千年精灵)(★JAVA★)  提出的难证码~!!!!
      

  13.   

    关于这个问题,我研究了很长时间,无非就是让自己获取对方网站的信息,我也考虑了很多种办法,但是由于显示出来的方式不同,有的数据是静态的,有的数据是动态的,有的是数据库里的,弄得乱七八糟,最后我选用了用delphi采取模拟键盘的方法,最愚蠢的 ctrl+a +c  +v 的方式先把对方的数据资料都调进我自己的数据库里,发现这个办法虽然笨,但是却无敌,也许你可以参照,目的达到了就好,其余的事情让计算机来做!
      

  14.   

    大家这个问题我也遇到过。
    1. 利用程序来访问受限网页是可行的。有很多的library可以支持。如:java的httpclient。
    Webdav。哪怕用perl、python等等都是可以的。
    2. 图片验证码是个棘手的问题。如果是最最简单的干净的JPEG数字图片,很容易,用open-source的ocr库来读就行了。但是如果是不规则的数字图片,ocr的准确率就不高了。
      

  15.   

    这个问题我遇到过。
    我曾经实现下载需要身份验证页面的代码!
    具体思路是:
    1、用一些监视http协议的软件获取该网站的session name。
    2、利用asp构架虚假的session对服务器欺骗。
    3、利用XMLHTTP获取数据!机器就是机器!
      

  16.   

    哦。忘记了。我是用asp实现的。不会php!
      

  17.   

    嗯,
    yangzixp(扬子.net):
    这个问题我遇到过。
    我曾经实现下载需要身份验证页面的代码!
    具体思路是:
    1、用一些监视http协议的软件获取该网站的session name。
    2、利用asp构架虚假的session对服务器欺骗。
    3、利用XMLHTTP获取数据!
    机器就是机器!看来我还得在我的网站里加入证书机构了,用aspx做网页,唉,没法子
      

  18.   

    yangzixp(扬子.net):可否告知什么软件获取网站的session name?是否只需一次获取?还是别的什么?
      

  19.   

    <?php
    class curl
    {
            var $ch = 0;
            var $time = 3;           //尝试判断URL正确性次数
            var $urlRight = false;   //URL是否正确
            var $content;            //官方返回信息
            var $errMsg = "";        //返回的错误信息        // 构造函数
            function curl()
            {
                    $this->init();
            }
            // 初始化curl
            function init()
            {
                    $this->ch = curl_init();
            }
            // configure protocol
            function get_Protocol($prot)
            {
                    $protocolArr = explode(":", $prot);
                    $protocol = strtolower($protocolArr[0]);
                    return $protocol;
            }        // 设置次数
            function setTimes($times) {
                    $this->time = ($times > 0) ? $times :   $this->time;
            }        // 获取页面
            function getPage($url, $header = 0) {
                    if (! $this->ch)
                    {
                            $this->errMsg = "初始化对象失败!";
                            return;
                    }
                    if ($this->checkURL($url) != 1)
                    {
                            $this->errMsg = "无效的URL路径!";
                            return;
                    }                curl_setopt($this->ch, CURLOPT_URL, $url);
                    curl_setopt($this->ch, CURLOPT_POST, 1);                if ($this->get_Protocol($url) == 'https')
                    {
                         curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 2);
                         curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, FALSE);
                    }                if($header) {
                 curl_setopt($this->ch, CURLOPT_VERBOSE, 1);
                 curl_setopt($this->ch, CURLOPT_HEADER, 1);
                    }
                    else {
                 curl_setopt($this->ch, CURLOPT_VERBOSE, 0);
                 curl_setopt($this->ch, CURLOPT_HEADER, 0);
                    }                curl_setopt($this->ch, CURLOPT_COOKIEJAR, "-");
                    curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);
                    curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
                    curl_setopt($this->ch, CURLOPT_TIMEOUT, 180);                return curl_exec($this->ch);
            }        // 登录
            function login($url, $fields, $refererURL=null)
            {
                    if (! $this->ch)
                    {
                            $this->errMsg = "初始化对象失败!";
                            return;
                    }
    /*
                    if ($this->checkURL($url) != 1)
                    { 
                            $this->errMsg = "无效的URL路径!";
                            return;
                    }
    */
                    if( $refererURL )
    {
       curl_setopt($this->ch, CURLOPT_REFERER, $refererURL);
    }
                    curl_setopt($this->ch, CURLOPT_URL, $url);
                    curl_setopt($this->ch, CURLOPT_POST, 1);                if ($this->get_Protocol($url) == 'https')
                    {
                         curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 2);
                         curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, FALSE);
                    }                curl_setopt($this->ch, CURLOPT_COOKIEJAR, "-");
                    curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);
                    curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
                    curl_setopt($this->ch, CURLOPT_POSTFIELDS, $fields);
                    curl_setopt($this->ch, CURLOPT_TIMEOUT, 180);                $this-> content = curl_exec($this->ch);
                   // return $content;
            }
            // 退出
            function logout($url, $referer_url=null)
            {
                    if (! $this->ch)
                    {
                            $this->errMsg = "初始化对象失败!";
                            return;
                    }                if( $referer_url )
                    {
                        curl_setopt($this->ch, CURLOPT_REFERER, $referer_url);
                    }
                    curl_setopt($this->ch, CURLOPT_URL, $url);
                    curl_setopt($this->ch, CURLOPT_POST, 1);                if ($this->get_Protocol($url) == 'https')
                    {
                         curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 2);
                         curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, FALSE);
                    }                curl_setopt($this->ch, CURLOPT_COOKIEJAR, "-");
                    curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);
                    curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
                    curl_setopt($this->ch, CURLOPT_TIMEOUT, 180);                $this-> content = curl_exec($this->ch);
                   // return $content;
            }        function getContent()
            {
                    return $this->content;  // 官方返回的HTML
            }  
            // close curl
            function close()
            {
                    if ($this->ch)
                    {
                            curl_close($this->ch);
                    }
            }
    }$curl = new curl;$url = "http://www.test.com/login.php";  //form 的action
    $fields = "username=test&password=test"; //用户名和密码
    $curl-> login($url, $fields);
    $content = getContent();echo $content;
    ?>
      

  20.   

    以前写的一个class,可以根据自己的需要做调试
      

  21.   

    要获取session name很容易。随便在网上down一个HTTP监控软件,监控一次你正常登陆该站的过程就可以了。