1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- date_default_timezone_set('Europe/Vienna');
- $date = date('d/m/Y h:i:s a', time());
- error_log("RETURN CPEE", 3, 'logs.log');
- error_log($date, 3, 'logs.log');
- error_log($_GET, 3, 'logs.log');
- error_log("\r\n", 3, 'logs.log');
- $opts = array('http' =>
- array(
- 'method' => 'PUT',
- 'header' => 'Content-type: application/json',
- 'content' => json_encode(array(
- "result"=>$_GET))
- )
- );
- $filename ='../callbacks/'. $_GET['id'].'.txt';
- $fContent = file_get_contents($filename);
- $fin = json_decode($fContent,true);
- $link = $fin[0]['HTTP_CPEE_CALLBACK'].'/';
- $context = stream_context_create($opts);
- $result = file_get_contents($link, false, $context);
- error_log("send PUT", 3, 'logs.log');
- error_log($date, 3, 'logs.log');
- error_log("\r\n", 3, 'logs.log');
- print_r($result);
- # delete file
- unlink($filename);
- # delete item in DTC list (in db bool marker 0 or 1)
- $data = file_get_contents('../callbacks/DTC_EVENT.txt');
- $dtc = json_decode($data, true);
- foreach ($dtc as $key => $value) {
- if (in_array($_GET['id'], $value)) {
- unset($dtc[$key]);
- }
- }
- $dtc = json_encode(array_values($dtc), JSON_PRETTY_PRINT);
- file_put_contents('../callbacks/DTC_EVENT.txt', $dtc);
- header("Location: http://192.168.20.133:8080/PHP/forms/start.html");
- exit;
- ?>
|