用 php 进行 http 认证
http://www.vividchanelhandbags.com/images/20000665.jpg这个图片http验证才能打开。写一个函数下载图片。知道验证的账号和密码
test 123789怎么做到呢。怎么通过函数传递账号密码呢?高手帮下
------解决方案--------------------
这叫乱码呀?呵呵
php code$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;
------解决方案--------------------
php code