<?php class HttpDownload { private $m_url = ""; private $m_urlpath = ""; private $m_scheme = "http"; private $m_host = ""; private $m_port = "80"; private $m_user = ""; private $m_pass = ""; private $m_path = "/"; private $m_query = ""; private $m_fp = ""; private $m_error = ""; private $m_httphead = "" ; private $m_html = ""; public 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; } } }
初始化-開啟指定網址--重設各參數-初始化系統-獲得某操作錯誤的原因-判別用Get方法發送的頭的應答結果是否正確-看看返回的網頁是否是text類型-判斷傳回的網頁是否是特定的類型- HTTP 協定下載檔案
本站所有資源皆由網友貢獻或各大下載網站轉載。請自行檢查軟體的完整性!本站所有資源僅供學習參考。請不要將它們用於商業目的。否則,一切後果都由您負責!如有侵權,請聯絡我們刪除。聯絡方式:admin@php.cn
相關文章
29 Jul 2016
: php下載遠端檔案類別支援斷點續傳:簡易使用方法: 複製程式碼程式碼如下:$object = new httpdownload(); $object->set_byfile($file)%N#H#%;//伺服器檔案名,包含路徑$object->filename = $filename;//下載另存為的檔案名稱$object->download(); 3.原始檔案: 複製程式碼如下:<? class http
09 Jun 2018
php 支援斷點續傳,主要依靠HTTP協定中 header HTTP_RANGE實作。 HTTP斷點續傳原理Http頭Range、Content-Range()HTTP頭中一般斷點下載時才用到Range和Content-Range實體頭,Range用戶請求頭中,指定第一個位元組的位置和最後一個位元組的位置,如(Range:200-300)Content-Range用於回應頭
29 Jul 2016
:php支援斷點續傳、分塊下載的類別:本文是為大家分享php支援斷點續傳、分塊下載的類,供大家參考,具體內容如下<php/*** User: djunny* Date : 2016-04-29* Time: 17:18* Mail: 199962760@qq.com* 支援斷點下載的類別*/class downloader {/*** download file to local path** @param $url* @param