The dedecms's dedededown class uses the following functions to obtain remote images. it is also valid when it is called, however, it is found that the following two calls are empty and the dededown class of dedecms cannot be obtained. the Function for obtaining remote images is as follows. it is also valid to pass the call, but the following two statements are blank, the function for obtaining remote images cannot be used as follows. it is valid to pass the previous code when calling the function. However, the following two statements are blank and cannot be used to obtain $ htd-& gt; the dededown function of ope dedecms to obtain remote images is used as follows. it is also valid when it is called. However, the following two statements cannot be obtained if they are empty.
Dedecms's dedededown class uses the following function to obtain remote images. it is also valid to pass the previous function when calling the function. However, the following two statements are found:
Null. cannot be obtained
The function for obtaining remote images is used as follows. it is also valid to pass the previous call. However, the following two statements are blank and cannot be obtained.
$ Htd-> openurl ($ url );
$ Htd-> gethead ("content-type ")
The preceding two statements are empty.
Function getremoteimage ($ url, $ rndtrueName)
{
// Echo $ url; [img] success
$ Revalues = array ();
$ OK = false;
$ Htd = new dedehttpdown ();
$ Htd-> openurl ($ url );
// Echo $ htd-> openurl ($ url );
$ Sparr = array ("image/pjpeg", "image/jpeg", "image/gif", "image/jpg", "image/png ",
"Image/xpng", "image/wbmp ");
If (! In_array ($ htd-> gethead ("content-type"), $ sparr ))
{
Echo "1 ";
Return "";
}
Make_dir (dirname ($ rndtrueName ));
$ Itype = $ htd-> gethead ("content-type ");
$ OK = $ htd-> savetobin ($ rndtrueName );
If ($ OK)
{
$ Data = getimagesize ($ rndtrueName );
$ Revalues [0] = $ rndtrueName;
List (, $ revalues [2], $ revalues [2]) = $ data;
}
$ Htd-> close ();
If ($ OK)
{
Return $ revalues;
}
Return "";
}
// Download an object over Http
Function savetobin ($ savefilename)
{
If (! $ This-> isgetok ())
{
Return false;
}
If (@ feof ($ this-> m_fp ))
{
$ This-> m_error = "The connection has been closed! ";
Return false;
}
$ Fp = fopen ($ savefilename, "w ");
While (! Feof ($ this-> m_fp ))
{
Fwrite ($ fp, fread ($ this-> m_fp, 1024 ));
}
Fclose ($ this-> m_fp );
Fclose ($ fp );
Return true;
}
// Open the specified URL
Function openurl ($ url, $ requestType = "GET ")
{
$ This-> resetany ();
$ This-> JumpCount = 0;
$ This-> m_httphead = array ();
// Print_r ($ this-> m_httphead );
/*
$ Extend = explode (\ ". \", $ url );
$ Va = count ($ extend)-1;
$ Extend [$ va];
$ This-> m_httphead [""] =
*/
$ This-> m_html = "";
$ This-> reTry = 0;
$ This-> close ();
// Initialize the system
$ This-> privateinit ($ url );
$ This-> privatestartsession ();
}
// Start an HTTP session
Function privatestartsession ($ requestType = "GET ")
{
If (! $ This-> privateopenhost ())
{
$ This-> m_error. = "an error occurred while opening the remote host! ";
Return false;
}