预览模式: 普通 | 列表

Php采集远程图片到本地

<?php
require_once('httpdown.class.php');
$img = "http://www.baidu.com/img/baidu_logo.gif";
//获取一个远程图片
$htd = new HttpDown();
$htd->OpenUrl($img);
$itype = $htd->GetHead("content-type");
if($itype=="image/gif")
{
 $itype = ".gif";
}
else if($itype=="image/png")
{
 $itype = ".png";
}
else if($itype=="image/wbmp")
{
 $itype = ".bmp";
}
else
{
 $itype = ".jpg";
}
$rndtrueName = "qerwerewre".$itype;
$ok = $htd->SaveToBin($rndtrueName);
$htd->Close();
?>
呵呵,采集类就不公开了,提供会员下载!

Tags: php

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 4972

 广告位

↑返回顶部↑