]+)\s([^>]+)>/'; // Matches "@" // Match only mention of specific URL from TARGET return preg_match($pattern, $twt); } if (stristr($_POST['source'], ".txt#")) { header($_SERVER['SERVER_PROTOCOL'] . ' 202 Accepted'); // Split URL into fragment and file path, and retrurns twt maching date $datetime = "/".parse_url($_POST['source'], PHP_URL_FRAGMENT)."/"; //$twtfile = strtok($_POST['source'], "#"); $txt = explode(PHP_EOL, $source); $twt = preg_grep($datetime, $txt); /* if (twtMentionInSource($twt) { $twtMention = "YES!"; } */ $logfile = './mentions.txt'; // Make sure file is writeable $log = date("Y-m-d\TH:i:s\Z") . "\t" ."Recived webmention from ".$_POST['source'] ." mentioning ".$_POST['target'] ." -- ".$twt.$datetime //." (IP: ".$_SERVER['REMOTE_ADDR'].")" .PHP_EOL; file_put_contents($logfile, $log, FILE_APPEND); } else { header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request'); exit; } ?>