@@ -55,7 +55,7 @@ public function __construct()
5555 {
5656 if (self ::USE_BENCHMARK === true ) {
5757 $ this ->benchmark = new Benchmark ();
58- $ this ->benchmark ->mark ('code_start ' );
58+ $ this ->benchmark ->mark ('code_background_request_start ' );
5959 }
6060 $ this ->logger = new Logger ();
6161 if (empty ($ this ->debugLoggerPath )) {
@@ -77,8 +77,8 @@ public function __construct()
7777 public function __destruct ()
7878 {
7979 if (self ::USE_BENCHMARK === true ) {
80- $ this ->benchmark ->mark ('code_end ' );
81- $ this ->logger ->debug (__FUNCTION__ , 'Elapsed Time: ===> ' . $ this ->benchmark ->elapsed_time ('code_start ' , 'code_end ' ));
80+ $ this ->benchmark ->mark ('code_background_request_end ' );
81+ $ this ->logger ->debug (__FUNCTION__ , 'Elapsed Time: ===> ' . $ this ->benchmark ->elapsed_time ('code_background_request_start ' , 'code_background_request_end ' ));
8282 $ this ->logger ->debug (__FUNCTION__ , 'Memory Usage: ===> ' . $ this ->benchmark ->memory_usage ());
8383 }
8484 }
@@ -97,7 +97,7 @@ public function __destruct()
9797 public static function backgroundHttpGet (string $ url ): bool
9898 {
9999 $ parts = parse_url ($ url );
100- if (strtolower ($ parts ['scheme ' ]) === 'https ' ) {
100+ if (mb_strtolower ($ parts ['scheme ' ]) === 'https ' ) {
101101 $ fp = fsockopen ('ssl:// ' . $ parts ['host ' ], $ parts ['port ' ] ?? self ::PORT_SSL , $ errno , $ errStr , self ::REQUEST_TIMEOUT );
102102 } else {
103103 $ fp = fsockopen ($ parts ['host ' ], $ parts ['port ' ] ?? self ::PORT_HTTP , $ errno , $ errStr , self ::REQUEST_TIMEOUT );
@@ -123,7 +123,7 @@ public static function backgroundHttpGet(string $url): bool
123123 /**
124124 * Hàm gọi 1 async POST Request để không delay Main Process
125125 *
126- * @param string $url Url Endpoint
126+ * @param string $url Url Endpoint
127127 * @param string $paramString Params to Request
128128 *
129129 * @return bool TRUE nếu thành công, FALSE nếu thất bại
@@ -151,7 +151,7 @@ public static function backgroundHttpPost(string $url, string $paramString = '')
151151 $ out = "POST " . $ parts ['path ' ] . "? " . $ parts ['query ' ] . " HTTP/1.1 \r\n" ;
152152 $ out .= "Host: " . $ parts ['host ' ] . "\r\n" ;
153153 $ out .= "Content-Type: application/x-www-form-urlencoded \r\n" ;
154- $ out .= "Content-Length: " . strlen ($ paramString ) . "\r\n" ;
154+ $ out .= "Content-Length: " . mb_strlen ($ paramString ) . "\r\n" ;
155155 $ out .= "Connection: Close \r\n\r\n" ;
156156 if ($ paramString !== '' ) {
157157 $ out .= $ paramString ;
0 commit comments