-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.php
More file actions
49 lines (45 loc) · 1.27 KB
/
index.php
File metadata and controls
49 lines (45 loc) · 1.27 KB
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
49
<?php
include('database.php');
/**
* Encrypt your proxy through the 9Hits API
*
* This method encrypts your proxy to protected it.
*
* @param proxy|array of proxy information
*
* @return object
*/
function encryptProxy($proxy) {
$url = 'http://proxy.9hits.com/we/encrypt-proxy?input='.urlencode(base64_encode(json_encode($proxy)));
$result = json_decode(file_get_contents($url));
return $result;
}
// Your code to get one proxy from your database or any source.
// Make sure your source code returns a unique proxy
// ......
/*$proxy = [
'type' => 'http', //must be one of ["socks4", "socks5", "http", "ssh"]
'server' => '156.54.219.109:8080', //required
'user' => '', //optional
'password' => '' //optional
];*/
$sql = $db->query("SELECT * FROM `proxy` ORDER BY RAND() LIMIT 1");
$data = $sql->fetch_assoc();
$proxy = [
'type' => $data['type'],
'server' => $data['server'],
'user' => $data['user'],
'password' => $data['password']
];
$result = encryptProxy($proxy);
/*
The result should be an object like this
{
"status": "ok|error",
"message": "Message from the 9Hits server",
"input": your input,
"output": Encrypted proxy
}
*/
echo $result->output;
?>