File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -22,4 +22,9 @@ public static function snimoeValueNotFound(): self
22
22
{
23
23
return new self ("SNlM0e value not found in response. Check __Secure-1PSID value. " );
24
24
}
25
+
26
+ public static function curlError ($ error ): self
27
+ {
28
+ return new self ("Curl error: " . $ error );
29
+ }
25
30
}
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ class LaravelBard
25
25
private $ reqid ;
26
26
private $ SNlM0e ;
27
27
28
- public function __construct ($ timeout = 6 , $ proxies = null , $ session = null )
28
+ public function __construct ($ timeout = 60 , $ proxies = null , $ session = null )
29
29
{
30
30
$ this ->proxies = $ proxies ;
31
31
$ this ->timeout = $ timeout ;
@@ -120,6 +120,11 @@ public function get_answer($input_text)
120
120
]);
121
121
122
122
$ resp = curl_exec ($ this ->session );
123
+
124
+ if (curl_errno ($ this ->session )) {
125
+ throw ErrorException::curlError (curl_error ($ this ->session ));
126
+ }
127
+
123
128
$ resp_dict = json_decode (explode ("\n" , $ resp )[3 ], true )[0 ][2 ];
124
129
125
130
if ($ resp_dict === null ) {
You can’t perform that action at this time.
0 commit comments