Browse Source

FIX: Service-> added a log to stream_socket_client

Giancarlo Voci 7 years ago
parent
commit
79dd5a523b
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/OpenMind/FindBox/FindBoxCoreSystem.php

+ 4 - 0
src/OpenMind/FindBox/FindBoxCoreSystem.php

@@ -84,11 +84,14 @@ class FindBoxCoreSystem
 	 */
 	 */
 	public function CallAPI(string $URI, string $Parameters, bool $skipResponse = false): array
 	public function CallAPI(string $URI, string $Parameters, bool $skipResponse = false): array
 	{
 	{
+		global $frameworkUtils;
+
 		$bodyJSON = null;
 		$bodyJSON = null;
 		$auth = "Authorization: Basic " . base64_encode("{$this->Key}:{$this->Pass}") . "\r\n";
 		$auth = "Authorization: Basic " . base64_encode("{$this->Key}:{$this->Pass}") . "\r\n";
 
 
 		$streamfbOS = @stream_socket_client("tcp://{$this->Host}:{$this->Port}", $errno, $errstr, 1);
 		$streamfbOS = @stream_socket_client("tcp://{$this->Host}:{$this->Port}", $errno, $errstr, 1);
 		if (!$streamfbOS) {
 		if (!$streamfbOS) {
+			$frameworkUtils->getLogger()->write("CallAPI::stream_socket_client error eode: [{$errno}]-'{$errstr}'", 'd/m/Y H:i:s');
 			return $this->returnCode($errno, $errstr);
 			return $this->returnCode($errno, $errstr);
 		} else {
 		} else {
 			//$requestText = "{$method} {$URI}{$Parameters} HTTP/1.0\r\nHost: {$this->Host}\r\n{$auth}Accept: */*\r\nConnection: close\r\n\r\n";
 			//$requestText = "{$method} {$URI}{$Parameters} HTTP/1.0\r\nHost: {$this->Host}\r\n{$auth}Accept: */*\r\nConnection: close\r\n\r\n";
@@ -140,6 +143,7 @@ class FindBoxCoreSystem
 
 
 		$streamfbOS = @stream_socket_client("tcp://{$this->Host}:{$this->Port}", $errno, $errstr, 1);
 		$streamfbOS = @stream_socket_client("tcp://{$this->Host}:{$this->Port}", $errno, $errstr, 1);
 		if (!$streamfbOS) {
 		if (!$streamfbOS) {
+			$frameworkUtils->getLogger()->write("AsyncCallAPI::stream_socket_client error eode: [{$errno}]-'{$errstr}'", 'd/m/Y H:i:s');
 			return $this->returnCode($errno, $errstr);
 			return $this->returnCode($errno, $errstr);
 		} else {
 		} else {
 			stream_set_blocking($streamfbOS, false);
 			stream_set_blocking($streamfbOS, false);