[PHP] 纯文本查看 复制代码
<?php
global $curl;
if (!isset($curl))
$curl = curl_init();
//获取 HTML
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_COOKIEJAR, 'cookies');
curl_setopt($curl, CURLOPT_COOKIFILE, 'cookies');
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.162 Safari/535
.19");
curl_setopt($curl, CURLOPT_REFERER, "http://www.mm8mm8.com/");
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
//获取图像
$image_url = 'http://tu1.mm8mm8.com/mm8/tupai/201201/024/1.jpg';
//curl_setopt($curl, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($curl, CURLOPT_URL, $image_url);
$image_string = curl_exec($curl);
header("Content-type: image/jpeg");
$image = imagecreatefromstring($image_string);
imagejpeg($image);
?>