I'm currently parsing for webmention endpoints with the following code. This works for either <link rel="webmention" href=" ">
or <link rel="http://webmention.org/" href=" ">
but not if both are included, i.e. <link rel="webmention http://webmention.org/" href=" ">
. And I'm struggling to adapt it to that. The code currently:
if(preg_match('/<(?:link|a)[ ]+href="([^"]+)"[ ]+rel="webmention"[ ]*\/?>/i', $body, $match)
|| preg_match('/<(?:link|a)[ ]+rel="webmention"[ ]+href="([^"]+)"[ ]*\/?>/i', $body, $match)) {
$endpoint = $match[1];
} elseif(preg_match('/<(?:link|a)[ ]+href="([^"]+)"[ ]+rel="http:\/\/webmention\.org\/?"[ ]*\/?>/i', $body, $match)
|| preg_match('/<(?:link|a)[ ]+rel="http:\/\/webmention\.org\/?"[ ]+href="([^"]+)"[ ]*\/?>/i', $body, $match)) {
$endpoint = $match[1];
}
Anyone any ideas?