1. Import
This commit is contained in:
64
html/tools/rfc.php
Normal file
64
html/tools/rfc.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/*=======================================================================
|
||||
*
|
||||
* rfc.php
|
||||
*
|
||||
* Remote Function Call
|
||||
*
|
||||
=======================================================================*/
|
||||
|
||||
|
||||
// Init
|
||||
$rfcProt = "https://";
|
||||
$rfcUrl = "mps1.assecutor.de/test_sb/";
|
||||
$accessCode = "7hb75hf73bfgfh437fhefb4u3fze3fur4f7u4zhiiuhhd673gth4373bdg48992";
|
||||
|
||||
|
||||
function get_url ($request_url) {
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $request_url);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$response = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
function create_url () {
|
||||
global $rfcProt,$rfcUrl,$accessCode,$functionName;
|
||||
global $par_01,$par_02,$par_03,$par_04,$par_05,$par_06,$par_07,$par_08,$par_09,$par_10;
|
||||
$request_url = $rfcProt . $rfcUrl . "tools/remote_function.php?functionName=" . urlencode($functionName) . "&par_01=" . urlencode($par_01) . "&par_02=" . urlencode($par_02) . "&par_03=" . urlencode($par_03) . "&par_04=" . urlencode($par_04) . "&par_05=" . urlencode($par_05) . "&par_06=" . urlencode($par_06) . "&par_07=" . urlencode($par_07) . "&par_08=" . urlencode($par_08) . "&par_09=" . urlencode($par_09) . "&par_10=" . urlencode($par_10) . "&accessCode=" . $accessCode;
|
||||
return $request_url;
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------
|
||||
|
||||
// Get current datetime
|
||||
$functionName = "getDateTime";
|
||||
$par_01 = "0"; // From zipcode
|
||||
$request_url = create_url();
|
||||
$response = get_url($request_url);
|
||||
$response = json_decode($response);
|
||||
$currDateTime = $response[0];
|
||||
echo "currDateTime : " . $currDateTime . "<br>";
|
||||
|
||||
// ----------------------------------------
|
||||
|
||||
// Gets zipcode price
|
||||
$functionName = "getZipcodeServiceValuesByZipcodes";
|
||||
$par_01 = "22851"; // From zipcode
|
||||
$par_02 = "22525"; // To zipcode
|
||||
$par_03 = "0"; // Static
|
||||
$par_04 = "2"; // Static
|
||||
$par_05 = $currDateTime; // Example date, e.g. "NOW()" from request above
|
||||
$request_url = create_url();
|
||||
$response = get_url($request_url);
|
||||
$response = json_decode($response);
|
||||
$price = $response[0];
|
||||
$discount = $response[1];
|
||||
echo "price : " . $price . "<br>";
|
||||
echo "discount : " . $discount . "<br>";
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user