background image

PHP 功能实现:下载 http 下载类代码

功能比较全的下载 http 资源类,同时可以获得 http 头的信息。
<?php
class DedeHttpDown
{
        public $m_url = “”;
        public $m_urlpath = “”;
        public $m_scheme = “http”;
        public $m_host = “”;
        public $m_port = “80 ;

        public $m_user = “”;
        public $m_pass = “”;
        public $m_path = “/”;
        public $m_query = “”;
        public $m_fp = “”;
        public $m_error = “”;
        public $m_httphead = “” ;
        public $m_html = “”;
 
        //初始化系统
        function PrivateInit($url)
        {
                $urls = “”;
                $urls = @parse_url($url);
                $this->m_url = $url;
                if(is_array($urls))
                {
                        $this->m_host = $urls["host"];
                                                if(!empty($urls["scheme"]))   $this->m_scheme   = 
$urls["scheme"];
                    
                        if(!empty($urls["user"])){
                                $this->m_user = $urls["user"];
                        }
                    
                        if(!empty($urls["pass"])){
                                $this->m_pass = $urls["pass"];
                        }