|
- <?php" C- U g& c F3 D! M' H) d
- if ($_GET['url']) {5 i6 ~9 n! Y; m" c7 L2 c1 ]
- $site='http://';
9 T7 z( |5 L* }% s; B4 H9 h9 w - $url=trim($site.$_GET['url']);
7 S7 \# Q( I" {# `% r - $info=file_get_contents($url); d$ n6 w; A9 ~3 B- {
- header('Content-type:text/json');
! H- `, F6 q6 i F - preg_match('|<title>(.*?)<\/title>|i',$info,$m);6 Y* y, Z; s5 h, @" H) {4 S3 U
- if($url){ 2 H) [0 y3 n1 C( |) ~
- $result=array("code"=>"200","title"=>$m[1]);
; t! x% L3 H3 z* ]; l% Z! Z4 \ - echo json_encode($result,JSON_UNESCAPED_UNICODE);2 N& Y; E/ C: E9 i
- }else{9 V4 i" _& R: s$ x* Z
- $result=array("code"=>"201","meg"=>"ERREO");' F# [& {/ e3 s9 r. I
- echo json_encode($result,JSON_UNESCAPED_UNICODE);9 ~* h& q5 o% c- s! E& V
- }/ u0 H" u5 d7 V$ _+ G
- }else{
& O2 A8 O% R" f3 |; t. Q - $result=array("code"=>"201","meg"=>"ERREO");
3 _7 t" X0 R8 O - echo json_encode($result,JSON_UNESCAPED_UNICODE);
' r9 G9 P6 L% O! {+ P - }2 k9 f+ q1 A3 N7 {" a& M- D8 D/ j
- //使用方法:http://xxx.com/xxx.php?url=www.baidu.com2 { } [9 {" v
- //欢迎访问:http://ilovem.cn 网站
( V; B( X6 g% Q8 k9 W - ?>
复制代码 |
|