}
}
function getRequest()
{
    ini_set('magic_quotes_gpc', false);
    global $debug;
    $request = $_POST['userRequest'];
    if (get_magic_quotes_gpc()) {
        $request = stripslashes($request);
    }
    return $request;
}
if (isset($_POST['userRequest'])) {
    $session = new LargeMerchantServiceSession('XML', 'XML', ENV_SANDBOX);
    $request = getRequest();
    $responseXML = $session->sendBulkDataExchangeRequest('startDownloadJob', $request);
    $xml = simplexml_load_string($responseXML);
    if (!empty($xml) && 'Success' == (string) $xml->ack) {
        $id_array = array("JobID" => (string) $xml->jobId);
    }
    PrintUtils::printXML($responseXML);
    parseResponseAndPrintExamples($xml);
}
?>
<hr />
<a href="./../index.php">Index</a>
<?php 
if (!empty($id_array['JobID'])) {
    ?>
<a href="./../GetJobStatus/GetJobStatus.php?jobId=<?php 
    echo $id_array['JobID'];
  </form>
<?php 
$debug = "";
function createUploadJobRequest($jobType, $uuid)
{
    global $debug;
    $request = '<createUploadJobRequest xmlns:sct="http://www.ebay.com/soaframework/common/types" xmlns="http://www.ebay.com/marketplace/services">';
    $request .= '<uploadJobType>' . $jobType . '</uploadJobType>';
    $request .= '<UUID>' . $uuid . '</UUID>';
    $request .= '</createUploadJobRequest>';
    return $request;
}
if (isset($_POST['jobType']) && isset($_POST['uuid'])) {
    $session = new LargeMerchantServiceSession('XML', 'XML', ENV_SANDBOX);
    $request = createUploadJobRequest($_POST['jobType'], $_POST['uuid']);
    $response = $session->sendBulkDataExchangeRequest('createUploadJob', $request);
    $xml = simplexml_load_string($response);
    if (!empty($xml) && 'Success' == (string) $xml->ack) {
        $id_array = array("JobID" => (string) $xml->jobId, "UploadID" => (string) $xml->fileReferenceId);
    }
    PrintUtils::printXML($response);
}
?>
<hr />
<a href="./../index.php">Index</a>
<?php 
if (!empty($id_array['JobID']) && !empty($id_array['UploadID'])) {
    ?>
<a href="./../UploadFile/UploadFile.php?taskReferenceId=<?php 
    echo $id_array['JobID'];
    ?>
<body>
  <form action="AbortJob.php" method="post">
    <p>Job ID
    <input type="text" name="jobId"<?php 
if (!empty($_REQUEST['jobId'])) {
    echo 'value="' . $_REQUEST['jobId'] . '" ';
}
?>
 /><br />
    <input type="submit" name="submit" value="Abort Job" /></p>
  </form>
<?php 
function createAbortJobRequest($jobId)
{
    $request = '<abortJobRequest xmlns:sct="http://www.ebay.com/soaframework/common/types" xmlns="http://www.ebay.com/marketplace/services">';
    $request .= '<jobId>' . $jobId . '</jobId>';
    $request .= '</abortJobRequest>';
    return $request;
}
if (isset($_POST['jobId'])) {
    $session = new LargeMerchantServiceSession('XML', 'XML', ENV_SANDBOX);
    $request = createAbortJobRequest($_POST['jobId']);
    $response = $session->sendBulkDataExchangeRequest('abortJob', $request);
    PrintUtils::printXML($response);
}
?>
<hr />
<a href="./../index.php">Index</a>
</body>
</html>
?>
 /><br />
    <input type="submit" name="submit" value="Get Job Status" /></p>
  </form>
<?php 
function createGetJobStatusRequest($jobId)
{
    $request = '<getJobStatusRequest xmlns:sct="http://www.ebay.com/soaframework/common/types" xmlns="http://www.ebay.com/marketplace/services">';
    $request .= '<jobId>' . $jobId . '</jobId>';
    $request .= '</getJobStatusRequest>';
    return $request;
}
if (isset($_POST['jobId'])) {
    $session = new LargeMerchantServiceSession('XML', 'XML', ENV_SANDBOX);
    $request = createGetJobStatusRequest($_POST['jobId']);
    $response = $session->sendBulkDataExchangeRequest('getJobStatus', $request);
    $xml = simplexml_load_string($response);
    if (!empty($xml) && 'Success' == (string) $xml->ack) {
        $id_array = array("JobID" => (string) $xml->jobProfile->jobId, "UploadID" => (string) $xml->jobProfile->inputFileReferenceId, "DownloadID" => (string) $xml->jobProfile->fileReferenceId);
    }
    PrintUtils::printXML($response);
}
?>
<hr />
<a href="./../index.php">Index</a>
<?php 
if (!empty($id_array['JobID'])) {
    ?>
<a href="./../AbortJob/AbortJob.php?jobId=<?php 
    echo $id_array['JobID'];
    ?>