如何保存页面中的图片? 我的页面中有这么一个图片:<img id=a name=a src="http://b.com/c.php">用户打开这个页面时,会从b.com请求一个图片,我如何能够将这个图片保存下来?请高手指点。谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 是你自己的文件么、 可以在c.php后加上image格式($image,目标位置)进行生成图片看起来貌似是验证码一类的吧! <img id=a name=a src="http://yourhost/getimage.php?url=http://b.com/c.php"> http://yourhost/getimage.php 为你服务器上文件 获取传递进来的 url 地址 用 file_get_contents 抓取传入连接(当然也可以用socket ) 然后生成本地文件 header("location: http://yourhost/本地生成图片地址") function urlclean(&$buffer){ $buffer = preg_replace('#href\s*=\s*(["\'])\?#is', 'href = \\1' . SITEBASE .'?', $buffer); $buffer = preg_replace_callback('#<img(.*?)src\s*=\s*(["\'])([^"\']*?)\\2(.*?)/?>#is' , 'imageLocalize' , $buffer); return $buffer;}function imageLocalize($matches){ $stle = $matches[1] . $matches[4]; preg_match_all('#width\s*(?:[\:="\']*?)(\d+)#is', $stle , $match); if(in_array(substr($matches['3'],0,6),array('http:/','ftp://','https:')) && stripos($matches['3'] , SITEBASE) === false && stripos($matches['3'] , '.bmp') === false) { return '<img '.$matches[1].' src='.$matches[2].''.SITEBASE.'getimage.php?url='.$matches[3].($match[1][0] ? '&size='.$match[1][0] : '') .$matches[2]. ' '.$matches[4].' />'; } else { return '<img '.$matches[1].' src='.$matches[2].$matches[3].$matches[2].' '.$matches[4].' />'; }} 有哪位做过人人网的登录绑定没 求助~!~ 页面中显示查询结果时,查询条件怎样不清除 正则问题 关于循环数组 写入 同一个字段的问题(请教) 求和的问题 活动帖问的问题徐老师不回答,再开一帖吧 问问大家都怎么结合Linux开发的 用PHP连接ORACLE 数据库,可不可以控制连接数,?? 代码在这里!看你怎么处理! 如何定时执行某一程序 如何将不同文件夹下的需求的图片复制到新文件夹去? 如何复位结果集状态
image格式($image,目标位置)进行生成图片
看起来貌似是验证码一类的吧!
function urlclean(&$buffer)
{
$buffer = preg_replace('#href\s*=\s*(["\'])\?#is', 'href = \\1' . SITEBASE .'?', $buffer);
$buffer = preg_replace_callback('#<img(.*?)src\s*=\s*(["\'])([^"\']*?)\\2(.*?)/?>#is' , 'imageLocalize' , $buffer);
return $buffer;
}function imageLocalize($matches)
{
$stle = $matches[1] . $matches[4];
preg_match_all('#width\s*(?:[\:="\']*?)(\d+)#is', $stle , $match); if(in_array(substr($matches['3'],0,6),array('http:/','ftp://','https:')) && stripos($matches['3'] , SITEBASE) === false && stripos($matches['3'] , '.bmp') === false)
{
return '<img '.$matches[1].' src='.$matches[2].''.SITEBASE.'getimage.php?url='.$matches[3].($match[1][0] ? '&size='.$match[1][0] : '') .$matches[2]. ' '.$matches[4].' />';
}
else
{
return '<img '.$matches[1].' src='.$matches[2].$matches[3].$matches[2].' '.$matches[4].' />';
}
}