/** * Pings mentions from a given page to any linked pages * @param $pageURL Page URL * @param string $text The text to mine for links * @return int The number of pings that were sent out */ static function pingMentions($pageURL, $text) { // Load webmention-client require_once \Idno\Core\site()->config()->path . '/external/mention-client-php/src/IndieWeb/MentionClient.php'; // Proxy connection string provided $proxystring = false; if (!empty(\Idno\Core\site()->config()->proxy_string)) { $proxystring = \Idno\Core\site()->config()->proxy_string; } $client = new \IndieWeb\MentionClient($pageURL, $text, $proxystring); return $client->sendSupportedMentions(); }
<?php // Note: if installing with composer you should require 'vendor/autoload.php' instead include 'src/IndieWeb/MentionClient.php'; $url = 'https://github.com/aaronpk/mention-client'; $client = new IndieWeb\MentionClient($url); $client->debug = true; $sent = $client->sendSupportedMentions(); echo "Sent {$sent} mentions\n";