比較的充実した機能を備えたhttpリソースクラスをダウンロードし、同時にhttpヘッダ情報を取得します。
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 = "";- : //初期化系统
- 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["ポート"];
- }
-
- 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 = "/";
- $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
http://www.bkjia.com/PHPjc/486141.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/486141.html技術記事 ?php class DedeHttpDown { public $m_url = "";パブリック $m_urlpath = "";パブリック $m_scheme = "http";公開...