代码很简单就不多废话了,直接奉上:
<"http://www.baidu.com/img/baidu_sylogo1.gif"); function httpcopy($url, $file="", $timeout=60) { $file = empty($file) " ","%20",$url); if(function_exists('curl_init')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $temp = curl_exec($ch); if(@file_put_contents($file, $temp) && !curl_error($ch)) { return $file; } else { return false; } } else { $opts = array( "http"=>array( "method"=>"GET", "header"=>"", "timeout"=>$timeout) ); $context = stream_context_create($opts); if(@copy($url, $file, $context)) { //$http_response_header return $file; } else { return false; } } } "htmlcode"><form method="post"> <input name="url" size="50" /> <input name="submit" type="submit" /> </form> < "rb"); if ($file) { $newf = fopen ($newfname, "wb"); if ($newf) while(!feof($file)) { fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 ); } } if ($file) { fclose($file); } if ($newf) { fclose($newf); } ?>以上所述就是本文的全部内容了,希望大家能够喜欢。