<?php
	session_start();
	
	/**
	 * @author Jan Wehrs (jan.wehrs@billpay.de)
	 * @copyright Copyright 2010 Billpay GmbH
	 * @license commercial 
	 */
	require_once '../../api/ipl_xml_api.php';
	require_once '../../api/php4/ipl_calculate_rates_request.php';
	
	$req = new ipl_calculate_rates_request($_SESSION['api-url-base']);
	$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
	$req->set_rate_request_params(26805, 27455);
	$req->set_locale("DEU", "EUR", "de");
	
	$internalError = $req->send();

	if ($internalError) {
		echo "Internal error occured!<br />";
		echo "Error code: 		" . $internalError['error_code'] . "<br />";
		echo "Error message: 	" . $internalError['error_message'];
	}
	else {
		if ($req->has_error()) {
			echo "Error occured!<br />";
			echo "Error code: " . $req->get_error_code() . "<br />";
			echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
			echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
		}
		else {
			echo 'Response data:<br />';
			echo '<pre>';
			print_r($req->get_options());
			echo '</pre>';
			
			echo "<br /><br />";
			echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
			echo "<br /><br />";
			echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
		}
	}
	
		
		

?>

