-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsaldos_services.php
111 lines (86 loc) · 3.25 KB
/
saldos_services.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
$uri_post = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$val = ':9091/saldos_services.php';
//$val = ':8080/homebanking/validalogin.jsp';
$hostname = php_uname('n');
//echo "href: " . $val;
if (strpos($uri_post, $val) !== false){
//echo "if 1<br>";
if ($_SERVER['REQUEST_METHOD'] == 'POST') //($_SERVER['REQUEST_METHOD'] == 'GET')
{
$op = $_POST['op'];
//echo "post POST saldos<br>";
//echo "op: ". $op;
//echo "if 2<br>";
if (strpos($op, "home_saldos") !== false) {
//echo "if 3<br>";
//echo "post POST saldos<br>";
$user_id = $_POST['user_id'];
//$pass = $_POST['user_password'];
//$type = $_POST['type'];
//$user_id = '13352626-9';
//$pass = '123456';
//$type = 'login';
$url = "http://python-saldos-services:9091/home_saldos";
$data = array('user_id' => $user_id );
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) { /* Handle error */ }
/*$fields = [
'user_id' => $user_id
];
$fields_string = http_build_query($fields);
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$result = curl_exec($ch);
$error = curl_error($ch);
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
*/
header("HTTP/1.1 200 OK");
//echo json_encode($result);
echo $result;
//echo "error:" .$error . "code status: " .$http_status;
exit();
}
if (strpos($op, "mov_saldos") !== false) {
$user_id = $_POST['user_id'];
//$pass = $_POST['user_password'];
//$type = $_POST['type'];
//$user_id = '13352626-9';
//$pass = '123456';
//$type = 'login';
$url = "http://python-saldos-services:9091/mov_saldos";
$data = array('user_id' => $user_id );
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) { /* Handle error */ }
header("HTTP/1.1 200 OK");
//echo json_encode($result);
echo $result;
//echo "error:" .$error . "code status: " .$http_status;
exit();
}
}
}else{
echo "href invalidax - >uri_post: ". $uri_post ." ". $val ;
exit();
}