<?php
/*
* Copyright 2020 Silvio Sparapano <ssilvio@libero.it>.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace api;
include_once 'spfApi.class.php';
$spfapi = new spfApi();
$command = $spfapi->getApiCommand();
error_log("command: ".$command);
$spfapi->setResponseCode(spfApi::SPF_API_RC_INVALID_COMMAND);
if($command == "getTest"){
$apiParams = $spfapi->getApiParam();
error_log("apiParams: ".print_r($apiParams,true));
$name = $spfapi->getPostParam("name",true);
error_log("name: ".$name);
$logo = $spfapi->getPostParam("logo");
error_log("logo: ".print_r($logo,true));
$spfapi->setResponseCode(spfApi::SPF_API_RC_OK);
$spfapi->setResponseValue("Welcome", $name);
}
if($command == "getTestForm"){
$file1 = $spfapi->getUploadFileInfo("myFile1");
error_log("myFile1: ".print_r($file1,true));
$file1Def = $spfapi->renameTempFileWithExtension("myFile1");
error_log("myFile1Def: ".print_r($file1Def,true));
$spfapi->setResponseCode(spfApi::SPF_API_RC_OK);
$spfapi->setResponseValue("Uploaded file", $file1Def);
}
echo($spfapi->getResponse());
|