File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -21,10 +21,13 @@ class CurlHttpAdapter implements HttpAdapterInterface
2121
2222 private $ connectTimeout ;
2323
24- public function __construct ($ timeout = null , $ connectTimeout = null )
24+ private $ userAgent ;
25+
26+ public function __construct ($ timeout = null , $ connectTimeout = null , $ userAgent = null )
2527 {
2628 $ this ->timeout = $ timeout ;
2729 $ this ->connectTimeout = $ connectTimeout ;
30+ $ this ->userAgent = $ userAgent ;
2831 }
2932
3033 /**
@@ -47,6 +50,10 @@ public function getContent($url)
4750 if ($ this ->connectTimeout ) {
4851 curl_setopt ($ c , CURLOPT_CONNECTTIMEOUT , $ this ->connectTimeout );
4952 }
53+
54+ if ($ this ->userAgent ) {
55+ curl_setopt ($ c , CURLOPT_USERAGENT , $ this ->userAgent );
56+ }
5057
5158 $ content = curl_exec ($ c );
5259 curl_close ($ c );
You can’t perform that action at this time.
0 commit comments