- 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 = "//m.sbmmt.com/m/";
- 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"];
- }
- if(!empty($urls["port"])){
- $this->m_port = $urls["port"];
- }
- if(!empty($urls["path"])) $this->m_path = $urls["path"];
- $this->m_urlpath = $this->m_path;
- if(!empty($urls["query"]))
- {
- $this->m_query = $urls["query"];
- $this->m_urlpath .= "?".$this->m_query;
- }
- }
- }
- //打开指定网址
- function OpenUrl($url)
- {
- //重设各参数
- $this->m_url = "";
- $this->m_urlpath = "";
- $this->m_scheme = "http";
- $this->m_host = "";
- $this->m_port = "80";
- $this->m_user = "";
- $this->m_pass = "";
- $this->m_path = "//m.sbmmt.com/m/";
- $this->m_query = "";
- $this->m_error = "";
- $this->m_httphead = "" ;
- $this->m_html = "";
- $this->Close();
- //初始化系统
- $this->PrivateInit($url);
- $this->PrivateStartSession();
- }
- //获得某操作错误的原因
- function printError()
- {
- echo "错误信息:".$this->m_error;
- echo "具体返回头:
"; - foreach($this->m_httphead as $k=>$v)
- {
- &nb声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
PHP编写的HTTP下载类代码
![VIP课程(WEB全栈开发)](http://m.sbmmt.com/img/upload/course/000/000/071/628e00599d7e4913.png)