@@ -172,7 +172,7 @@ public function post_call($path, $params, $retry = 0 )
172
172
$ context = stream_context_create ($ opts );
173
173
$ result = @file_get_contents ($ url , false , $ context );
174
174
175
- if (empty ($ result ) || (isset ($ http_response_header ) && $ http_response_header [0 ] != ' HTTP/1.0 200 OK ' ) ) // empty if server is down
175
+ if (empty ($ result ) || (isset ($ http_response_header ) && ! str_contains ( $ http_response_header [0 ], ' 200 OK ')) ) // empty if server is down
176
176
{
177
177
$ this ->msg ( "Host Failed: {$ url }" );
178
178
@@ -200,10 +200,10 @@ 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 (empty ($ http_response_header ) || $ http_response_header [0 ] == ' HTTP/1.0 404 NOT FOUND ' )
203
+ if (empty ($ http_response_header ) || str_contains ( $ http_response_header [0 ], ' 404 NOT FOUND ') )
204
204
return null ;
205
205
206
- if (empty ($ result ) || (isset ($ http_response_header ) && $ http_response_header [0 ] != ' HTTP/1.0 200 OK ' ) ) // empty if server is down
206
+ if (empty ($ result ) || (isset ($ http_response_header ) && ! str_contains ( $ http_response_header [0 ], ' 200 OK ')) ) // empty if server is down
207
207
{
208
208
$ this ->msg ( "Host Failed: {$ url }" );
209
209
0 commit comments