GC_HTTP_Requests_Response::get_cookies()
最后更新于:2021-12-01 11:11:52
GC_()Retrieves cookies from the response.
响应
(GC_HTTP_Cookie[]) List of cookie objects.
源文件
文件: gc-includes/class-gc-http-requests-response.php
public function get_cookies() {
$cookies = array();
foreach ( $this->response->cookies as $cookie ) {
$cookies[] = new GC_Http_Cookie(
array(
'name' => $cookie->name,
'value' => urldecode( $cookie->value ),
'expires' => isset( $cookie->attributes['expires'] ) ? $cookie->attributes['expires'] : null,
'path' => isset( $cookie->attributes['path'] ) ? $cookie->attributes['path'] : null,
'domain' => isset( $cookie->attributes['domain'] ) ? $cookie->attributes['domain'] : null,
'host_only' => isset( $cookie->flags['host-only'] ) ? $cookie->flags['host-only'] : null,
)
);
}
return $cookies;
}