1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| <!DOCTYPE html> <html lang=“zh-CN”> <head> <meta charset=“UTF-8”> <meta name=“viewport” content=“width=device-width initial-scale=1.0, user-scalable=yes”> <title>Bing每日一图-采集结果</title> <body> <?php $getcontents = file_get_contents(‘http://cn.bing.com’); preg_match(“/([.a-zA-Z0-9-_])*\.jpg/”,$getcontents,$filename); if (preg_match(“/(\/?([.a-zA-Z0-9-_])*)*jpg/”,$getcontents,$imgurl)) { $img = file_get_contents(‘http://’.$imgurl[0]); file_put_contents($filename[0],$img); $sendto = “xxx@xxx.xxx”; $subject = date(“Y年m月d日”).” Bing每日一图采集结果报告-成功”; $message = date(“Y-m-d H:i:s”).” Bing每日一图采集成功!”; $from = “admin@lihuan.com.cn”; $headers = “From: $from”; if(@mail($sendto,$subject,$message,$headers)) { echo date(“Y-m-d H:i:s”).” 发送成功!”; } else { echo date(“Y-m-d H:i:s”).” 发送失败!”; } } else { if (preg_match(“/(\/([.a-zA-Z0-9-_])*)*jpg/”,$getcontents,$imgurl)) { $img = file_get_contents(‘http:’.$imgurl[0]); file_put_contents($filename[0],$img); $sendto = “xxx@xxx.xxx”; $subject = date(“Y年m月d日”).” Bing每日一图采集结果报告-成功”; $message = date(“Y-m-d H:i:s”).” Bing每日一图采集成功!”; $from = “admin@lihuan.com.cn”; $headers = “From: $from”; if(@mail($sendto,$subject,$message,$headers)) { echo date(“Y-m-d H:i:s”).” 发送成功!”; } else { echo date(“Y-m-d H:i:s”).” 发送失败!”; } } else { $sendto = “xxx@xxx.xxx”; $subject = date(“Y年m月d日”).” Bing每日一图采集结果报告-失败”; $message = date(“Y-m-d H:i:s”).” Bing每日一图采集失败!\n”.$getcontents; $from = “admin@lihuan.com.cn”; $headers = “From: $from”; if(@mail($sendto,$subject,$message,$headers)) { echo date(“Y-m-d H:i:s”).” 发送成功!”; } else { echo date(“Y-m-d H:i:s”).” 发送失败!”; } } } ?> </body> </html>
|