@@ -20,6 +20,7 @@ private function _fetchHtml($word)
20
20
curl_setopt ($ ch , CURLOPT_FOLLOWLOCATION , true );
21
21
curl_setopt ($ ch , CURLOPT_SSL_VERIFYHOST , false ); // Disable SSL host verification
22
22
curl_setopt ($ ch , CURLOPT_SSL_VERIFYPEER , false ); // Disable SSL peer verification
23
+ curl_setopt ($ ch , CURLOPT_TIMEOUT , 60 );
23
24
24
25
$ response = curl_exec ($ ch );
25
26
@@ -42,6 +43,7 @@ private function _request__KBBI_API_Zhirrr($word)
42
43
curl_setopt ($ ch , CURLOPT_FOLLOWLOCATION , true );
43
44
curl_setopt ($ ch , CURLOPT_SSL_VERIFYHOST , false ); // Disable SSL host verification
44
45
curl_setopt ($ ch , CURLOPT_SSL_VERIFYPEER , false ); // Disable SSL peer verification
46
+ curl_setopt ($ ch , CURLOPT_TIMEOUT , 60 );
45
47
46
48
$ response = curl_exec ($ ch );
47
49
@@ -309,11 +311,16 @@ private function _KBBI_byZhirrr($word): array
309
311
310
312
public function searchWord ($ word )
311
313
{
312
- // OFFICIAL
313
- $ _KBBI_official = $ this ->_KBBI_official ($ word );
314
- if (count ($ _KBBI_official ))
315
- {
316
- return $ _KBBI_official ;
314
+ try {
315
+ // OFFICIAL
316
+ $ _KBBI_official = $ this ->_KBBI_official ($ word );
317
+ if (count ($ _KBBI_official ))
318
+ {
319
+ return $ _KBBI_official ;
320
+ }
321
+ } catch (\Exception $ e ) {
322
+ // Log the error message or handle it as needed
323
+ error_log ("Official API error: " . $ e ->getMessage ());
317
324
}
318
325
319
326
// ZHIRRR
0 commit comments