From e72c8cf6758afa0a48385ed8b015ba448ba413c2 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Sun, 7 Jan 2018 16:37:44 -0800 Subject: [PATCH] include additional info in callback and status API --- controllers/API.php | 3 +++ lib/Telegraph/Webmention.php | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/controllers/API.php b/controllers/API.php index 5292d05..fd4258a 100644 --- a/controllers/API.php +++ b/controllers/API.php @@ -301,6 +301,9 @@ class API { if($status && $status->http_code) $data['http_code'] = (int)$status->http_code; + if($status && $status->raw_response) + $data['http_body'] = $status->raw_response; + if($summary) $data['summary'] = $summary; diff --git a/lib/Telegraph/Webmention.php b/lib/Telegraph/Webmention.php index b97ba36..0d60f39 100644 --- a/lib/Telegraph/Webmention.php +++ b/lib/Telegraph/Webmention.php @@ -45,15 +45,21 @@ class Webmention { $payload = [ 'source' => $webmention->source, 'target' => $webmention->target, - 'status' => $code + 'status' => $code, ]; if($webmention->webmention_endpoint) { $payload['type'] = 'webmention'; - } - if($webmention->pingback_endpoint) { + } elseif($webmention->pingback_endpoint) { $payload['type'] = 'pingback'; } + if($status->http_code) { + $payload['http_code'] = $status->http_code; + } + if($raw) { + $payload['http_body'] = $raw; + } + return self::$http->post($webmention->callback, $payload); } }