<?php

include_once("config.php");

if (isset($_GET['storename'])) {
    $storename = $_GET['storename'];
    $address = $_GET['address'];
    $city=$_GET['city'];
    $province = $_GET['province']; 
    $postal = $_GET['postal']; 
    $contactname = $_GET['contactname']; 
    $phone = $_GET['phone']; 
    $fax = $_GET['fax']; 
    $email = $_GET['email']; 
    $dispensarysoftware = $_GET['dispensarysoftware']; 
    $efttransit = $_GET['efttransit']; 
    $eftaccountnumber = $_GET['eftaccountnumber']; 
    $eftpayor = $_GET['eftpayor'];
    $hoursofoperation = $_GET['hoursofoperation']; 
    $dispensarysoftwareid = $_GET['dispensarysoftwareid']; 
    $bannerid = $_GET['bannerid']; 

} else {
	
    $storename = $_POST['storename'];
    $address = $_POST['address'];
    $city=$_POST['city'];
    $province = $_POST['province']; 
    $postal = $_POST['postal']; 
    $contactname = $_POST['contactname']; 
    $phone = $_POST['phone']; 
    $fax = $_POST['fax']; 
    $email = $_POST['email']; 
    $dispensarysoftware = $_POST['dispensarysoftware']; 
    $efttransit = $_POST['efttransit']; 
    $eftaccountnumber = $_POST['eftaccountnumber']; 
    $eftpayor = $_POST['eftpayor'];
    $hoursofoperation = $_POST['hoursofoperation']; 
    $dispensarysoftwareid = $_POST['dispensarysoftwareid']; 
    $bannerid = $_POST['bannerid']; 
}


     $storename = urlencode(stripslashes($storename));
     $address = urlencode(stripslashes($address));
     $city=urlencode(stripslashes($city));
     $province=urlencode(stripslashes($province));
     $postal=urlencode(stripslashes($postal));
     $contactname=urlencode(stripslashes($contactname));
     $phone=urlencode(stripslashes($phone));
     $fax=urlencode(stripslashes($fax));
     $email=urlencode(stripslashes($email));
     $dispensarysoftware=urlencode(stripslashes($dispensarysoftware));
     $efttransit=urlencode(stripslashes($efttransit));
     $eftaccountnumber=urlencode(stripslashes($eftaccountnumber));
     $eftpayor=urlencode(stripslashes($eftpayor));
     $hoursofoperation=urlencode(stripslashes($hoursofoperation));
     $dispensarysoftwareid=urlencode(stripslashes($dispensarysoftwareid));
     $bannerid=urlencode(stripslashes($bannerid));

     $params .= "storename=" . $storename;
     $params .= "&address=" . $address;
     $params .= "&city=" . $city;
     $params .= "&province=" . $province;
     $params .= "&postal=" . $postal;
     $params .= "&contactname=" . $contactname;
     $params .= "&phone=" . $phone;
     $params .= "&fax=" . $fax;
     $params .= "&email=" . $email;
     $params .= "&dispensarysoftware=" . $dispensarysoftware;
     $params .= "&efttransit=" . $efttransit;
     $params .= "&eftaccountnumber=" . $eftaccountnumber;
     $params .= "&eftpayor=" . $eftpayor;
     $params .= "&hoursofoperation=" . $hoursofoperation;
     $params .= "&dispensarysoftwareid=" . $dispensarysoftwareid;
     $params .= "&bannerid=" . $bannerid;
     $params .= "&scode=" . $scode;


     $url =  $xml_server_url_secure."amjayregisterstore?".$params;

$ch = curl_init();

// Set query data here with the URL
curl_setopt($ch, CURLOPT_URL, $url); 
$header=array(0=>'Accept: text/xml,image/jpg');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, '3');
curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 
$content = trim(curl_exec($ch));
if ($content === false) {
    die('Error fetching data: ' . curl_error($curl));   
}


curl_close($ch);


//$template = new registerstore2_page("template_registerstore2.html",$storename,$address,$city,$province,$postal,$contactname,$phone,$fax,$email,$dispensarysoftware,$efttransit,$eftaccountnumber,$eftpayor,$hoursofoperation,$cppackage,$cpnursinghome,$dispensarysoftwareid,$bannerid);
//$template->show();
//echo $url;
header('Content-type: text/xml');
print $content;


//echo $content;


?>