- // XXX: the fetcher only gives back one of each header, so this may fail on multiple Link headers
- if(preg_match('~<((?:https?://)?[^>]+)>; rel="webmention"~', $result->headers['Link'], $match)) {
- return $match[1];
- } elseif(preg_match('~<((?:https?://)?[^>]+)>; rel="http://webmention.org/?"~', $result->headers['Link'], $match)) {
- return $match[1];
+ if (isset($result->headers['Link'])) {
+ // XXX: the fetcher only gives back one of each header, so this may fail on multiple Link headers
+ if(preg_match('~<((?:https?://)?[^>]+)>; rel="webmention"~', $result->headers['Link'], $match)) {
+ return $match[1];
+ } elseif(preg_match('~<((?:https?://)?[^>]+)>; rel="http://webmention.org/?"~', $result->headers['Link'], $match)) {
+ return $match[1];
+ }