-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapi.php
45 lines (35 loc) · 1.02 KB
/
api.php
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
<?php
/*
* This file is part of the Geek-Zoo Projects.
*
* @copyright (c) 2010 Geek-Zoo Projects More info http://www.geek-zoo.com
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License
* @author quqiang <[email protected]>
*
*/
// echo curt::cc('http://www.google.com');
// echo curt::preView('http://curt.cc/akz8b');
class curt
{
const CURT_URL = 'http://curt.cc/service/generator.php?url=';
const VIEW_URL = 'http://curt.cc/service/previewer.php?url=';
public static function cc($url)
{
$url = self::CURT_URL.urlencode($url);
$result = @json_decode(@file_get_contents($url), true);
if (isset($result['url'])) {
return $result['url'];
}
return '';
}
public static function preView($url)
{
$url = self::VIEW_URL.urlencode($url);
$result = @json_decode(@file_get_contents($url), true);
if (isset($result['url'])) {
return $result['url'];
}
return '';
}
}
?>