-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconnect.php
48 lines (41 loc) · 1.02 KB
/
connect.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
46
47
48
<?php
header("Access-Control-Allow-Origin : * ");
if (isset($_GET['section'])) {
$section = $_GET['section'];
$data = file_get_contents('http://api-1cak.herokuapp.com/'.$section);
echo $data;
}
if (isset($_GET['param']) && isset($_GET['next'])) {
$section = $_GET['param'];
$next = $_GET['next'];
$data = file_get_contents('http://api-1cak.herokuapp.com/'.$section.'/'.$next);
echo $data;
}
if(isset($_GET['search'])){
$keyword = $_GET['search'];
$data = file_get_contents('http://api-1cak.herokuapp.com/search?q='.$keyword);
echo $data;
}
if (isset($_GET['url'])) {
$url = $_GET['url'];
if(urlExists($url)){
echo "success";
}else{
echo "Failed";
}
}
function urlExists($url=NULL)
{
if($url == NULL) return false;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if($httpcode>=200 && $httpcode<300){
return true;
} else {
return false;
}
}
?>