mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-30 12:14:36 +00:00
Merge pull request #103 from zachborboa/master
Update README with download() and setUserAgent() examples
This commit is contained in:
@@ -99,7 +99,7 @@ $curl->download('https://www.example.com/image.png', '/tmp/myimage.png');
|
||||
```php
|
||||
// Case-insensitive access to headers.
|
||||
$curl = new Curl();
|
||||
$curl->get('https://www.example.com/image.png');
|
||||
$curl->download('https://www.example.com/image.png', '/tmp/myimage.png');
|
||||
echo $curl->response_headers['Content-Type'] . "\n"; // image/png
|
||||
echo $curl->response_headers['CoNTeNT-TyPE'] . "\n"; // image/png
|
||||
```
|
||||
@@ -117,7 +117,7 @@ curl_close($curl->curl);
|
||||
```php
|
||||
// Requests in parallel with callback functions.
|
||||
$curl = new Curl();
|
||||
$curl->setOpt(CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1');
|
||||
$curl->setUserAgent('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1');
|
||||
|
||||
$curl->success(function($instance) {
|
||||
echo 'call to "' . $instance->url . '" was successful. response was' . "\n";
|
||||
|
||||
Reference in New Issue
Block a user