Skip to content

Instantly share code, notes, and snippets.

@aaronpk
Created February 3, 2016 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronpk/07519e51bcf033d55981 to your computer and use it in GitHub Desktop.
Save aaronpk/07519e51bcf033d55981 to your computer and use it in GitHub Desktop.
<?php
$input = json_decode(file_get_contents('php://input'));
if($input && property_exists($input, 'items') && count($input->items)) {
$item = $input->items[0];
$url = $item->permalinkUrl;
$ch = curl_init('https://telegraph.p3k.io/webmention');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
'token' => 'xxxx.YOUR.TOKEN.HERE.xxxx',
'source' => $url,
'target_domain' => 'example.com'
]));
curl_exec($ch);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment