-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitio.php
32 lines (30 loc) · 905 Bytes
/
gitio.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
<?php
$talkContent = "";
$url=addslashes($_POST['url']);
function send_post($url, $post_data) {
$postdata = http_build_query($post_data);
$options = array(
'http' => array(
'method' => 'POST',
'header' => 'Content-type:application/x-www-form-urlencoded',
'content' => $postdata,
'timeout' => 15 * 60
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
if(get_headers($url)) {
$post_data = array('url'=>"https://mabbs.github.io/jump.html?url=".$url );
$talkContent = send_post('https://git.io/create', $post_data);
header('text/html; charset=utf-8');
header('Access-Control-Allow-Origin: *');
echo $talkContent;
} else {
header('HTTP/1.1 500 Internal Server Error');
header('text/html; charset=utf-8');
header('Access-Control-Allow-Origin: *');
echo "Invalid url: ".$url;
}
?>