时间:2021-07-01 10:21:17 帮助过:29人阅读
$url = "http://www.vividchanelhandbags.com/images/20000665.jpg"; $ch = curl_init($url); $useragent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"; $header = array('Accept-Language: zh-cn','Connection: Keep-Alive','Cache-Control: no-cache'); //HEADER信息 curl_setopt($ch,CURLOPT_HTTPHEADER,$header); //USER_AGENT curl_setopt($ch, CURLOPT_USERAGENT, $useragent); curl_setopt( $ch, CURLOPT_USERPWD , "test:123789"); $response = curl_exec($ch); //你获取的是图片二进制内容,要显示图片,就得告诉浏览器,内容格式是什么 header("content-type:image/jpg"); echo $response;
------解决方案--------------------