Just wrote practicing's work. The feeling is still some practical value. Let's try it out for everyone.
Function: Implement Agent function through PHP
Applicable users: Slow download at home. And too lazy to find proxy. And there are high-speed host, and the host has PHP, and host support socket.
How to use:
1. Upload this program to the mainframe.
2. Browsing this file on the host through the browser
3. Fill in the URL to download the file address (if necessary, you can fill in the Referer)
4. Click Get proxy URL
5. The link in the newly opened page is the link that is downloaded via proxy
Attention:
1. Multi-Threaded Download, breakpoint continued transmission
2. HTTP protocol only supported
3. Server-Side header redirection is not supported
4. HTTP AUTH not supported
5. When downloading a larger file, you can modify the value of the Set_time_limit in the program to reduce the disconnection (default is 180, or 3 minutes)
var $_strurl;
var $_arrargv;
var $_strref;
var $_arrurl;
var $_ressocket;
var $_interror;
var $_strerror;
var $_arrdefaultarrayurl;
var $_arrdefaultport;
function Cphpproxy ($STRURL = null, $ARRARGV = Array ()) {
$this->init ();
Is_null ($STRURL) ": $this->seturl ($STRURL);
Is_null ($arrArgv [' refer '])? ': $this->setref ($arrArgv [' refer ']);
$this->proxy ($STRURL, $ARRARGV);
}
function SetError ($intError, $mixArgv =null) {
$this->_interror = $intError;
if ($intError ==1001) {
$this->_strerror = "parameter pass error while calling $MIXARGV method, enumeration value does not exist";
}elseif ($intError ==1) {
$this->_strerror = "url is incorrect, URL is malformed. \ n". $mixArgvs;
}elseif ($intError = = 2) {
$this->_strerror = "URL error, this protocol is not currently supported. \ n". $mixArgvs;
}elseif ($intError = = 3) {
$this->_strerror = "Cannot open". $this->_arrurl[' host '. ': '. $this->_arrurl[' Port '. " \ n ". $mixArgv [0]. ': '. $mixArgv [1];
}
echo URL for download
if (${$strGetArrayName}[' act ']== ' make ') {
Die ("<center>}
Fetch file
$objProxy->proxy ();
Error handling
if ($objProxy->geterror ()) {
Die ($objProxy->geterror (pp_error_message));
}
?>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.