File tree Expand file tree Collapse file tree 1 file changed +36
-1
lines changed Expand file tree Collapse file tree 1 file changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -164,4 +164,39 @@ The function's return value is exactly what is returned from the server as part
164164 // DELETE /session/:sessionId/window
165165 $session->deleteWindow();
166166
167- ### See also [ wiki page of examples] ( https://github.com/facebook/php-webdriver/wiki/Example-command-reference ) .
167+ ## More esoteric examples
168+
169+ * To set curl options (e.g., timeout and proxy settings)
170+
171+ ```
172+ use WebDriver\Service\CurlService;
173+ use WebDriver\ServiceFactory;
174+
175+ class MyCurlService extends CurlService
176+ {
177+ const PROXY = 'http://proxyHost:8080';
178+ const AUTH = 'proxyUser:proxyPassword';
179+
180+ /**
181+ * {@inheritdoc}
182+ */
183+ public function execute($requestMethod, $url, $parameters = null, $extraOptions = null)
184+ {
185+ $extraOptions = array_replace(
186+ $extraOptions,
187+ array(
188+ CURLOPT_CONNECTTIMEOUT => 30,
189+ CURLOPT_TIMEOUT => 300,
190+ CURLOPT_PROXY => self::PROXY,
191+ CURLOPT_PROXYUSERPWD => self::AUTH,
192+ )
193+ );
194+
195+ return parent::execute($requestMethod, $url, $parameters, $extraOptions);
196+ }
197+ }
198+
199+ ServiceFactory::setServiceClass('service.curl', 'MyCurlService');
200+ ```
201+
202+
You can’t perform that action at this time.
0 commit comments