preg_match('@p\.php\?p=(.*)@Ui', $url, $url);//获取图片地址
if(isset($url[1]))
$url=$url[1];
else
$url='';
if($url):
//curl抓取图片过程
$ch = curl_init();
if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) {
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
}
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$content = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
if ($info['http_code'] != 200)
$content = NULL;
if($content)//保存图片到本地
@file_put_contents ('存放地址', $content);
endif;