diff options
Diffstat (limited to 'it_url.class')
-rw-r--r-- | it_url.class | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/it_url.class b/it_url.class index 5997141..c605c91 100644 --- a/it_url.class +++ b/it_url.class @@ -37,6 +37,7 @@ class it_url var $page_read; /* true if page read */ var $title; /* Page title or empty */ var $description; /* Page description or empty */ + var $cookies; /* key => values of cookies from server */ var $headers; /* Headers of page fetched by get() */ var $data; /* Data part, even if return code is not 200 */ @@ -284,6 +285,8 @@ function parse_http_header($header) $this->headers[$parts[1]] = $this->result = $parts[2]; elseif (preg_match('#^([^:]+): (.*)$#', $line, $parts)) $this->headers[$parts[1]] = $parts[2]; + if ($parts[1] == 'Set-Cookie' && preg_match('/^([^=]+)=([^;]*)/', $parts[2], $cookie)) + $this->cookies[$cookie[1]] = $cookie[2]; } } @@ -297,7 +300,7 @@ function request($p=array()) $url->result = $result = false; unset($url->data); - $url->headers = array(); + $url->headers = $url->cookies = array(); $p['timeout'] = min($p['timeout'], $p['totaltimeout']); # No operation may be longer than totaltimeout $endtime = time() + $p['totaltimeout']; |