]> git.mxchange.org Git - friendica.git/blob - src/Module/Inbox.php
We now use the regular probing function
[friendica.git] / src / Module / Inbox.php
1 <?php
2 /**
3  * @file src/Module/Inbox.php
4  */
5 namespace Friendica\Module;
6
7 use Friendica\BaseModule;
8 use Friendica\Protocol\ActivityPub;
9 use Friendica\Core\System;
10
11 /**
12  * ActivityPub Inbox
13  */
14 class Inbox extends BaseModule
15 {
16         public static function init()
17         {
18                 $a = self::getApp();
19
20                 $postdata = file_get_contents('php://input');
21
22                 if (empty($postdata)) {
23                         System::httpExit(400);
24                 }
25
26                 if (ActivityPub::verifySignature($postdata, $_SERVER)) {
27                         $filename = 'signed-activitypub';
28                 } else {
29                         $filename = 'failed-activitypub';
30                 }
31
32                 $tempfile = tempnam(get_temppath(), $filename);
33                 file_put_contents($tempfile, json_encode(['header' => $_SERVER, 'body' => $postdata]));
34
35                 System::httpExit(200);
36         }
37 }