|
1 | 1 | <?php |
| 2 | +error_reporting(0); |
2 | 3 | ini_set ('memory_limit', '256M'); |
3 | 4 | header("Content-type:text/html;charset=utf-8"); |
4 | 5 |
|
|
8 | 9 | echo "error"; |
9 | 10 | exit(); |
10 | 11 | } |
| 12 | + |
| 13 | + |
11 | 14 | function getCurl($url, $post = 0, $cookie = 0, $header = 0, $nobaody = 0) |
12 | 15 | { |
13 | 16 | $ch = curl_init(); |
@@ -42,19 +45,21 @@ function getCurl($url, $post = 0, $cookie = 0, $header = 0, $nobaody = 0) |
42 | 45 | } |
43 | 46 |
|
44 | 47 |
|
45 | | -if (isset($_POST['base64'])){ |
46 | | - $b64 = $_POST['base64']; |
47 | | - $s = base64_decode($b64); |
48 | | - $img_path = './image/'.md5($s).'.jpg'; |
49 | | - file_put_contents($img_path, $s,LOCK_EX); |
50 | | -}else{ |
51 | | - $s = file_get_contents($_FILES["file"]["tmp_name"]); |
52 | | - $img_path = './image/'.md5($s).'.jpg'; |
53 | | - file_put_contents($img_path, $s,LOCK_EX); |
54 | | -} |
55 | | -$url='http://'.$_SERVER['SERVER_NAME'].str_replace("/test.php","",$_SERVER["REQUEST_URI"]).str_replace("./","/",$img_path); |
56 | 48 |
|
57 | 49 | try{ |
| 50 | + if (isset($_POST['base64'])){ |
| 51 | + $b64 = $_POST['base64']; |
| 52 | + $s = base64_decode($b64); |
| 53 | + $img_path = './image/'.md5($s).'.jpg'; |
| 54 | + file_put_contents($img_path, $s,LOCK_EX); |
| 55 | + }else{ |
| 56 | + $s = file_get_contents($_FILES["file"]["tmp_name"]); |
| 57 | + $img_path = './image/'.md5($s).'.jpg'; |
| 58 | + file_put_contents($img_path, $s,LOCK_EX); |
| 59 | + } |
| 60 | + $url='http://'.$_SERVER['SERVER_NAME'].str_replace("/test.php","",$_SERVER["REQUEST_URI"]).str_replace("./","/",$img_path); |
| 61 | + |
| 62 | + |
58 | 63 | $res = getCurl("https://cli.im/apis/up/deqrimg","img=".urlencode($url)); |
59 | 64 | $obj = json_decode($res); |
60 | 65 | $text = $obj->info->data[0]; |
|
0 commit comments