More work on parsing endpoints in the body
This commit is contained in:
1 parent
4eba80387d
commit
e5f7595321
2 files changed
+41
No files matched your search
@@ -3,6 +3,7 @@
|
||||
namespace Lewisdale\Webmentions;
|
||||
|
||||
use Symfony\Contracts\HttpClient\ResponseInterface;
|
||||
use Symfony\Component\DomCrawler\Crawler;
|
||||
|
||||
class EndpointParser {
|
||||
public static function parse(ResponseInterface $response) : string | null
|
||||
@@ -22,6 +23,11 @@ class EndpointParser {
|
||||
}
|
||||
}
|
||||
|
||||
if (!$endpoint) {
|
||||
$doc = new Crawler($response->getContent());
|
||||
$webmention = $doc->filter('rel="webmention"')->first();
|
||||
}
|
||||
|
||||
if ($endpoint && !str_contains($endpoint, "https://")) {
|
||||
$res = parse_url($response->getInfo('url'));
|
||||
$endpoint = $res["scheme"] . "://" . $res["host"] . $endpoint;
|
||||
|
||||
Reference in new issue
Block a user