Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4a864a9

Browse files
authored
Merge pull request #5 from foodlz/master
Fixed header related to HTTP version
2 parents b346587 + 4411c71 commit 4a864a9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎src/NlpClient.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public function post_call($path, $params, $retry = 0 )
172172
$context = stream_context_create($opts);
173173
$result = @file_get_contents($url, false, $context);
174174

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
176176
{
177177
$this->msg( "Host Failed: {$url}" );
178178

@@ -200,10 +200,10 @@ public function get_call($path, $params, $retry = 0)
200200
$this->msg( "NLP API [GET] $path - $url");
201201
$result = @file_get_contents( $url, false );
202202

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'))
204204
return null;
205205

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
207207
{
208208
$this->msg( "Host Failed: {$url}" );
209209

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /