@@ -200,7 +200,7 @@ public function get_call($path, $params, $retry = 0)
200
200
$ this ->msg ( "NLP API [GET] $ path - $ url " );
201
201
$ result = @file_get_contents ( $ url , false );
202
202
203
- if ( $ http_response_header [0 ] == 'HTTP/1.0 404 NOT FOUND ' )
203
+ if ( empty ( $ http_response_header ) || $ http_response_header [0 ] == 'HTTP/1.0 404 NOT FOUND ' )
204
204
return null ;
205
205
206
206
if ( empty ($ result ) || ( isset ($ http_response_header ) && $ http_response_header [0 ] != 'HTTP/1.0 200 OK ' ) ) // empty if server is down
@@ -238,10 +238,21 @@ private function msg( $value )
238
238
{
239
239
if ( is_array ($ value ) )
240
240
{
241
- fwrite (STDOUT , print_r ( $ value , true ) . PHP_EOL );
241
+ if (!defined ('STDOUT ' ))
242
+ {
243
+ print_r ( $ value );
244
+ }else {
245
+ fwrite (STDOUT , print_r ( $ value , true ) . PHP_EOL );
246
+ }
242
247
}
243
- else
244
- fwrite (STDOUT , $ value . PHP_EOL );
248
+ else
249
+ {
250
+ if (!defined ('STDOUT ' )){
251
+ echo $ value . PHP_EOL ;
252
+ }else {
253
+ fwrite (STDOUT , $ value . PHP_EOL );
254
+ }
255
+ }
245
256
}
246
257
}
247
258
0 commit comments