예제 #1
0
<?php

session_start();
?>

<?php 
header('Content-Type: application/json');
include 'classes.php';
$jsonResult = new JSON(array(), null, array());
$config = $jsonResult->GetAccesToken();
if ($config !== null) {
    AddAuction($config, $jsonResult);
} else {
    $jsonResult->json_data['result_code'] = JSON::$resultCodes['token_error'];
}
print $jsonResult->PrepareJSON();
function AddAuction($config, $jsonResult)
{
    $id = $_GET['auction_id'];
    $sandbox = $_GET['sandbox'];
    $conn = new connection($config);
    $jsonResult->json_data['result_code'] = JSON::$resultCodes['ok'];
    $allegroConn = new ALLEGRO();
    if ($sandbox) {
        if (!$allegroConn->Connect($allegroConn->sandbox)) {
            $jsonResult->json_data['result_code'] = JSON::$resultCodes['allegro_error'];
            return;
        }
    } else {
        if (!$allegroConn->Connect($allegroConn->production)) {
            $jsonResult->json_data['result_code'] = JSON::$resultCodes['allegro_error'];