<?php
$photo = 'http://www.xxx.com/uploads/5908618d80559a594164d984c5ca2b01_32.png';
if ($photo) {
$http = new HttpRequest($photo, HTTP_METH_GET);
try {
$http->send();
} catch(Exception $e) {
try {
$http->send();
} catch (Exception $e) {
try {
$http->send();
} catch (Exception $e) {
echo 'error occured while loading file.';
exit;
}
}
}
if ($http->getResponseCode() == 200) {
$header = $http->getResponseHeader();
if (strstr($header['Content-Type'], 'image') !== FALSE) {
echo base64_encode($http->getResponseBody());
}
}
}
?>
posted on 2011-07-22 09:45
jadmin 阅读(103)
评论(0) 编辑 收藏