Skip to content

Commit 6aa16bb

Browse files
committed
Update doc/README
Add curl service example and remove outdated link to upstream wiki page.
1 parent 488c5ca commit 6aa16bb

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

doc/README.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff 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+

0 commit comments

Comments
 (0)