forked from 5-systems/win_apache
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
a.titov
committed
Nov 13, 2019
1 parent
c9f7c06
commit 6dcebaf
Showing
2 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
error_reporting(E_ALL); | ||
ini_set('display_errors', 1); | ||
|
||
require_once('../settings.php'); | ||
require_once('../5c_files_lib.php'); | ||
|
||
date_default_timezone_set('Etc/GMT-3'); | ||
|
||
# Settings (change) | ||
$LogFileName='../logs/messenger/telegram_'.date('Ym').".txt"; | ||
|
||
header('Content-Type: text/html; charset=utf-8'); | ||
|
||
@$body=file_get_contents("php://input"); | ||
|
||
If( !isset($body) ) { | ||
$body='{"error":"no data"}'; | ||
} | ||
|
||
# Write log info | ||
$fp = fopen($LogFileName, 'a'); | ||
if ($fp) { | ||
|
||
$mytext=date('Ymd H:i:s').' '; | ||
while( list($key, $value)=each($_REQUEST) ) { | ||
$mytext.=$key.'='.$value.', '; | ||
} | ||
|
||
$mytext.='body='.$body.PHP_EOL; | ||
|
||
$test = fwrite($fp, $mytext); | ||
fclose($fp); | ||
} | ||
|
||
ini_set("soap.wsdl_cache_enabled", "0"); | ||
|
||
$SoapClient1C = Null; | ||
|
||
try { | ||
$SoapClient1C = new SoapClient("http://".$http_server.":".$http_server_port."/".trim($publication_path, ' /')."/ws/wsMessenger.1cws?wsdl", array('login'=>$user_login, 'password'=>$user_password)); | ||
} | ||
catch (Exception $e) { | ||
echo "0"; | ||
} | ||
|
||
$params=Array(); | ||
$params['body']=$body; | ||
|
||
try { | ||
$Result = $SoapClient1C->WebHook($params); | ||
echo "ok"; | ||
} | ||
catch (Exception $e) { | ||
$fp = fopen($LogFileName, 'a'); | ||
$error_text='Exception: '.$e->getMessage(); | ||
$test = fwrite($fp, '-33-'); | ||
$test = fwrite($fp, $error_text); | ||
fclose($fp); | ||
exit('1'); | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
error_reporting(E_ALL); | ||
ini_set('display_errors', 1); | ||
|
||
require_once('../settings.php'); | ||
require_once('../5c_files_lib.php'); | ||
|
||
# Set timezone | ||
date_default_timezone_set('Etc/GMT-3'); | ||
|
||
$LogFileName='../logs/messenger/whatsapp_'.date('Ym').".txt"; | ||
|
||
header('Content-Type: text/html; charset=utf-8'); | ||
|
||
@$body=file_get_contents("php://input"); | ||
|
||
If( !isset($body) ) { | ||
$body='{"error":"no data"}'; | ||
} | ||
|
||
# Write log info | ||
$fp = fopen($LogFileName, 'a'); | ||
if ($fp) { | ||
|
||
$mytext=date('Ymd H:i:s').' '; | ||
while( list($key, $value)=each($_REQUEST) ) { | ||
$mytext.=$key.'='.$value.', '; | ||
} | ||
|
||
$mytext.='body='.$body.PHP_EOL; | ||
|
||
$test = fwrite($fp, $mytext); | ||
fclose($fp); | ||
} | ||
|
||
ini_set("soap.wsdl_cache_enabled", "0"); | ||
try { | ||
$SoapClient1C = new SoapClient("http://".$http_server.":".$http_server_port."/".trim($publication_path, ' /')."/ws/wsMessenger.1cws?wsdl", array('login'=>$user_login, 'password'=>$user_password)); | ||
} | ||
catch (Exception $e) { | ||
echo "0"; | ||
} | ||
|
||
$params=Array(); | ||
$params['body']=$body; | ||
|
||
try { | ||
$Result = $SoapClient1C->WebHook($params); | ||
echo "ok"; | ||
} | ||
catch (Exception $e) { | ||
$fp = fopen($LogFileName, 'a'); | ||
$error_text='Exception: '.$e->getMessage(); | ||
$test = fwrite($fp, '-33-'); | ||
$test = fwrite($fp, $error_text); | ||
fclose($fp); | ||
exit('1'); | ||
} | ||
|
||
?> |