Skip to content

Instantly share code, notes, and snippets.

Last active January 14, 2022 12:39
  • Star 16 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
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