#!/usr/bin/php . * * @category Core * @package Galette * * @author Johan Cwiklinski * @copyright 2013-2014 The Galette Team * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version * @link http://galette.tuxfamily.org * @since Available since 0.7.5dev - 2013-06-10 */ $args = array(); $internal = false; if (defined('STDIN')) { //we're called from command line $args = stream_get_contents(STDIN); } else if (count($_POST) > 0) { //we're called from HTTP POST $args = $_POST; //check if we're called from galette internal if (isset($_POST['galette_internal'])) { $internal = true; include_once 'includes/galette.inc.php'; unset($_POST['galette_internal']); Analog\Analog::info( 'Requested as Galette HTTP POST with parameters:' . "\n" . print_r($args, true) ); } else { echo 'Requested as HTTP POST with parameters:
'; } } else if (count($_GET) > 0) { //we're called from HTTP GET echo 'Requested as HTTP GET with parameters:
'; $args = $_GET; } if (count($args) == 0) { //we're called without arguments => exit. die('No arguments.'); } if (defined('STDIN')) { //a successfull script returns 0, we do not output anything $fp = fopen(__DIR__ . '/cache/galette_post_contrib_file.txt', 'w'); fwrite($fp, $args); fclose($fp); } else { $json_args = json_decode($args); foreach ($json_args as $k => $v) { echo 'key: ' . $k . ' | value: ' . $v; } }