Skip to content

Commit ef4468d

Browse files
committed
Fix php-curl-class#305: Implement Curl::getResponseCookies()
1 parent 44a5322 commit ef4468d

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ Curl::getCookie($key)
211211
Curl::getInfo($opt = null)
212212
Curl::getOpt($option)
213213
Curl::getResponseCookie($key)
214+
Curl::getResponseCookies()
214215
Curl::head($url, $data = array())
215216
Curl::options($url, $data = array())
216217
Curl::patch($url, $data = array())

examples/get_response_cookies.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
require __DIR__ . '/../vendor/autoload.php';
3+
4+
use \Curl\Curl;
5+
6+
$curl = new Curl();
7+
$curl->get('https://secure.php.net/');
8+
9+
if ($curl->error) {
10+
echo 'Error: ' . $curl->errorCode . ': ' . $curl->errorMessage . "\n";
11+
} else {
12+
echo 'Response cookies:' . "\n";
13+
var_dump($curl->responseCookies);
14+
var_dump($curl->getResponseCookies());
15+
}

src/Curl/Curl.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,18 @@ public function getResponseCookie($key)
745745
return isset($this->responseCookies[$key]) ? $this->responseCookies[$key] : null;
746746
}
747747

748+
/**
749+
* Get Response Cookies
750+
*
751+
* @access public
752+
*
753+
* @return array
754+
*/
755+
public function getResponseCookies()
756+
{
757+
return $this->responseCookies;
758+
}
759+
748760
/**
749761
* Set Max Filesize
750762
*

0 commit comments

Comments
 (0)