Skip to content

Instantly share code, notes, and snippets.

Last active November 2, 2023 06:16
  • Star 17 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save adactio/6484118 to your computer and use it in GitHub Desktop.
Minimum viable webmention in PHP.
# Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
if (!isset($_POST['source']) || !isset($_POST['target'])) {
header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request');
$ch = curl_init($_POST['source']);
curl_setopt($ch,CURLOPT_USERAGENT,'mydomain (');
$ok = curl_exec($ch);
$source = ob_get_contents();
header($_SERVER['SERVER_PROTOCOL'] . ' 202 Accepted');
if (stristr($source, $_POST['target'])) {
# Now do something with $source e.g. parse it for h-entry and h-card and store what you find.
Copy link

tantek commented Sep 8, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment