Finish implementing endpoint discovery for Webmentions

This commit is contained in:
Lewis Dale committed 2023-03-08 21:27:47 +00:00
1 parent e5f7595321
commit b63ada6dea
5 files changed
+312 -20

No files matched your search

+2 -3
View File
@@ -2,7 +2,6 @@
namespace Lewisdale\Webmentions;
use DOMDocument;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Contracts\HttpClient\HttpClientInterface;
@@ -22,14 +21,14 @@ class Webmention {
// $this->sendWebmention($source, $target);
// }
$this->sendWebmention($source, "https://webmention.rocks/test/1");
$this->sendWebmention($source, "https://webmention.rocks/test/23/page");
}
private function getUrls(string $url) : array {
$page = file_get_contents($url);
$doc = new Crawler($page);
$urls = [];
$urls = [];
foreach ($doc->filter('.h-entry a') as $anchor) {
$target_url = $anchor->attributes->getNamedItem('href')->textContent;