Example #1
0
<?php

// Include the Companies House module...
require_once '../../../GovTalk.php';
require_once '../VAT.php';
// Include the Companies House configuration
require_once 'config.php';
if (isset($_GET['formdata'])) {
    $hmrcVat = new HmrcVat($hmrcUserId, $hmrcPassword, 'vsips');
    if ($pollRequest = $hmrcVat->declarationRequest($_GET['vatnumber'], $_GET['periodid'], $_GET['capacity'], $_GET['formdata'][1], $_GET['formdata'][2], $_GET['formdata'][4], $_GET['formdata'][6], $_GET['formdata'][7], $_GET['formdata'][8], $_GET['formdata'][9])) {
        echo 'Return successfully submitted.<br /><br />';
        echo 'Endpoint: ' . $pollRequest['endpoint'] . '<br />';
        echo 'Interval: ' . $pollRequest['interval'] . ' seconds<br />';
        echo 'Correlation: ' . $pollRequest['correlationid'] . '<br />';
        echo '<br /><a href="submit-poll.php?endpoint=' . urlencode($pollRequest['endpoint']) . '&correlation=' . urlencode($pollRequest['correlationid']) . '">Poll for HMRC response.</a><br />';
    } else {
        echo 'Return was rejected by the Government Gateway: ';
        var_dump($hmrcVat->getResponseErrors());
    }
} else {
    ?>

<form action="" method="get">
	VAT number: <input name="vatnumber" type="text" value="999900001" /><br />
	Period ID: <input name="periodid" type="text" value="2009-01" /><br />
	Capacity:
	<select name="capacity">
		<option>Individual</option>
		<option>Company</option>
		<option>Agent</option>
		<option>Bureau</option>