File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 1212class HttpRequest
1313{
1414 private $ _ch ;
15- private $ _timeout = 10 ;
1615 private $ _url ;
1716 private $ _data ;
1817
@@ -21,12 +20,17 @@ public function __construct ($url = null) {
2120 if ($ url !== null ) {
2221 $ this ->_url = $ url ;
2322 }
24- curl_setopt ($ this ->_ch , CURLOPT_TIMEOUT , $ this -> _timeout );
23+ curl_setopt ($ this ->_ch , CURLOPT_TIMEOUT , 10 );
2524 curl_setopt ($ this ->_ch , CURLOPT_RETURNTRANSFER , true );
2625 curl_setopt ($ this ->_ch , CURLOPT_FAILONERROR , true );
2726 curl_setopt ($ this ->_ch , CURLOPT_FOLLOWLOCATION , true );
2827 }
2928
29+ public function setTimeout ($ timeout ) {
30+ curl_setopt ($ this ->_ch , CURLOPT_TIMEOUT , $ timeout );
31+ return $ this ;
32+ }
33+
3034 public function setBasicAuth ($ username , $ password ) {
3135 curl_setopt ($ this ->_ch , CURLOPT_USERPWD , $ username . ": " . $ password );
3236 return $ this ;
You can’t perform that action at this time.
0 commit comments