public static function receive(Application $app, SiteModel $siteModel = null) { $data = file_get_contents('php://input'); $app['monolog']->addError("receivepingback.php got data " . $data); $pingback = ParsePingBack::parseFromData($data); if ($pingback) { $pbil = new \incominglinks\PingBackIncomingLink(); $pbil->setSourceURL($pingback->getSourceUrl()); $pbil->setTargetURL($pingback->getTargetUrl()); $pbil->setReporterIp($_SERVER['REMOTE_ADDR']); $pbil->setReporterUseragent($_SERVER['HTTP_USER_AGENT']); $repo = new \repositories\IncomingLinkRepository(); $repo->create($pbil, $siteModel); print '<?xml version="1.0" encoding="ISO-8859-1"?> <methodResponse> <params> <param> <value><string>Reported</string></value> </param> </params> </methodResponse>'; } else { // TODO } }
public static function receive(Application $app, SiteModel $siteModel = null) { $data = array_merge($_POST, $_GET); if (isset($data['source']) && isset($data['target'])) { $pbil = new \incominglinks\WebMentionIncomingLink(); $pbil->setSourceURL($data['source']); $pbil->setTargetURL($data['target']); $pbil->setReporterIp($_SERVER['REMOTE_ADDR']); $pbil->setReporterUseragent($_SERVER['HTTP_USER_AGENT']); $repo = new \repositories\IncomingLinkRepository(); $repo->create($pbil, $siteModel); header("HTTP/1.0 202 "); print "WebMention Received"; } else { // TODO } }