<?php
    require_once('rlDHL.class.php');
	
	$GLOBALS['config']['shc_dhl_test_mode'] = true;

	$rlDHL = new rlDHL();

	$search = array(
			'{message_time}',
			'{reference}',
			'{siteid}',
			'{password}',
			'{from_country_code}',
			'{from_postal_code}',
			'{from_city}',
			'{vat_no}',
			'{payment_country_code}',
			'{bkg_date}',
			'{bkg_ready_time}',
			'{bkg_weight}',
			'{to_country_code}',
			'{to_postal_code}',
			'{to_city}',
			'{vat_no}'
		);

	$ts = time();
	$reference = $ts . $ts . $ts . $ts . $ts . $ts . $ts . $ts . $ts . $ts;
	$reference = substr($reference, 0, 30);
		
	$replacement = array(
			date("c"),
			$reference,
			'911comprep',
			'DiiC08pR3p',
			'DE',
			'01774',
			'',
			'',
			'DE',
			date('Y-m-d'),
			'PT10H21M',
			'0.5',
			'KG',
			'720001',		
			'',
			''			
		);

	$xml = str_replace($search, $replacement, $rlDHL -> xml_schema );
	$response = $rlDHL -> post( $xml );
	$response_data = $rlDHL -> parse( $response );
	
    $quote = array(
			'PRODUCTSHORTNAME' =>  $response_data['PRODUCTSHORTNAME'][0],
			'TOTALTRANSITDAYS' => $response_data['TOTALTRANSITDAYS'][0],
			'DELIVERYDATE' => $response_data['DELIVERYDATE'][0],
			'TOTALAMOUNT' => round($response_data['SHIPPINGCHARGE'][0] * $response_data['EXCHANGERATE'][0], 2) . ' USD'
		);

	print_r($quote);
?>