api_get_user($a);
- $postdata = file_get_contents('php://input');
+ $postdata = Network::postdata();
if (empty($postdata)) {
throw new BadRequestException("No post data");
use Friendica\Protocol\DFRN;
use Friendica\Protocol\Diaspora;
use Friendica\Util\Strings;
+use Friendica\Util\Network;
function dfrn_notify_post(App $a) {
Logger::log(__function__, Logger::TRACE);
- $postdata = file_get_contents('php://input');
+ $postdata = Network::postdata();
if (empty($_POST) || !empty($postdata)) {
$data = json_decode($postdata);
use Friendica\Model\Contact;
use Friendica\Protocol\OStatus;
use Friendica\Util\Strings;
+use Friendica\Util\Network;
use Friendica\Core\System;
function hub_return($valid, $body)
function pubsub_post(App $a)
{
- $xml = file_get_contents('php://input');
+ $xml = Network::postdata();
Logger::log('Feed arrived from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $a->cmd . ' with user-agent: ' . $_SERVER['HTTP_USER_AGENT']);
Logger::log('Data: ' . $xml, Logger::DATA);
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Protocol\Diaspora;
+use Friendica\Util\Network;
/**
* @param App $a App
Logger::log('mod-diaspora: receiving post', Logger::DEBUG);
if (empty($_POST['xml'])) {
- $postdata = file_get_contents("php://input");
+ $postdata = Network::postdata();
if ($postdata == '') {
throw new \Friendica\Network\HTTPException\InternalServerErrorException();
}
use Friendica\Protocol\Salmon;
use Friendica\Util\Crypto;
use Friendica\Util\Strings;
+use Friendica\Util\Network;
function salmon_post(App $a, $xml = '') {
if (empty($xml)) {
- $xml = file_get_contents('php://input');
+ $xml = Network::postdata();
}
Logger::log('new salmon ' . $xml, Logger::DATA);
use Friendica\Database\DBA;
use Friendica\Protocol\ActivityPub;
use Friendica\Util\HTTPSignature;
+use Friendica\Util\Network;
/**
* ActivityPub Inbox
{
$a = self::getApp();
- $postdata = file_get_contents('php://input');
+ $postdata = Network::postdata();
if (empty($postdata)) {
throw new \Friendica\Network\HTTPException\BadRequestException();
return $curlResponse;
}
+ /**
+ * Return raw post data from a post request
+ *
+ * @return string post data
+ */
+ public static function postdata()
+ {
+ return file_get_contents('php://input');
+ }
+
/**
* @brief Check URL to see if it's real
*