PHP code example of zegnat / webmention-endpoint-discovery

1. Go to this page and download the library: Download zegnat/webmention-endpoint-discovery library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zegnat / webmention-endpoint-discovery example snippets

 php
$discoverer = new Zegnat\Webmention\EndpointDiscovery($httpClient, $requestFactory);
echo $discoverer->discover('https://webmention.rocks/test/1');
// https://webmention.rocks/test/1/webmention\?head=true
 php
$discoverer = new Zegnat\Webmention\EndpointDiscovery($httpClient, $requestFactory);
var_export($discoverer->secureDiscover('https://webmention.rocks/test/1'));
// array (
//   'url' => 'https://webmention.rocks/test/1/webmention?head=true',
//   'host' => 'webmention.rocks',
//   'ips' =>
//   array (
//     0 => '173.230.155.197',
//   ),
// )