我有从服务器发送以下响应。如何将字符串www-authenticate的部分提取到名为$ realm,$ nonce,$ opaque的变量中?如何在变量中使用http头响应值?
正在由卷曲请求产生以下输出和即时打印响应头:
HTTP/1.1 401 Unauthorized
Cache-Control: private
Date: Fri, 23 Dec 2011 05:49:41 GMT
Content-Length: 0
Content-Type: text/html
WWW-Authenticate: Digest realm="[email protected]", nonce="3133323436313933383137343820335916269c13227f30b07bd83a1c7e0d", opaque="6e6f742075736564"
RETS-Version: RETS/1.5
X-Powered-By: Servlet/2.5 JSP/2.1
此简短代码在多行标题值方面存在问题。请注意,RFC是在这里:[rfc2616 4.2 Message Headers](http://tools.ietf.org/html/rfc2616#section-4.2) – hakre 2012-08-04 20:38:36