How to best parse 1 HTTP header VALUE in PHP?

  • Thread starter Thread starter MG
  • Start date Start date

MG

New Member
I have a very important, detailed HTTP header in my response that I want to parse the value of to get the details:\[code\]Digest realm="My Very, Very Cool Site", nonce="A8W/7aDZBAA=ffc2afd053c8802dd64be69b985f38c85ec29607", algorithm=MD5, domain="/", qop="auth"\[/code\]It's obviously comma-separated, but it's also quoted, so values can contain \[code\],\[/code\]. There's also \[code\]"Digest "\[/code\] that's not part of the \[code\]key="value"\[/code\]-pairs. (I can assume the first part ("Digest") will never contain spaces, so that shouldn't be too hard.I'm thinking the most sure way is to byte-by-byte parse and look for \[code\]"\[/code\] and \[code\],\[/code\], but that's a lot of work.It might be I'm missing a very useful PHP SPL function. I tried \[code\]http_parse_headers()\[/code\], but that's unstandard and I don't have that.
 
Back
Top