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
21
21
22
22
private $ connectTimeout ;
23
23
24
- public function __construct ($ timeout = null , $ connectTimeout = null )
24
+ private $ userAgent ;
25
+
26
+ public function __construct ($ timeout = null , $ connectTimeout = null , $ userAgent = null )
25
27
{
26
28
$ this ->timeout = $ timeout ;
27
29
$ this ->connectTimeout = $ connectTimeout ;
30
+ $ this ->userAgent = $ userAgent ;
28
31
}
29
32
30
33
/**
@@ -47,6 +50,10 @@ public function getContent($url)
47
50
if ($ this ->connectTimeout ) {
48
51
curl_setopt ($ c , CURLOPT_CONNECTTIMEOUT , $ this ->connectTimeout );
49
52
}
53
+
54
+ if ($ this ->userAgent ) {
55
+ curl_setopt ($ c , CURLOPT_USERAGENT , $ this ->userAgent );
56
+ }
50
57
51
58
$ content = curl_exec ($ c );
52
59
curl_close ($ c );
You can’t perform that action at this time.
0 commit comments