Released under the GNU General Public License
*/
require 'includes/application_top.php';
require_once 'doba/DobaProducts.php';
include_once 'doba/DobaApi.php';
include_once 'doba/DobaProductAPI.php';
$msg = '';
$api = new DobaApi();
if (isset($_POST['submit'])) {
    require_once 'doba/DobaInteraction.php';
    $watchlist_id = isset($_POST['watchlist_id']) ? intval($_POST['watchlist_id']) : 0;
    if ($watchlist_id > 0) {
        $action = DOBA_API_ACTION_GETPRODUCTDETAIL;
        $data = array('watchlist_id' => $watchlist_id);
        if ($api->compileRequestXml($action, $data) && $api->sendRequest()) {
            $objDobaProducts = DobaProductAPI::parseProductDetails($api->getResponseXml());
            if (is_a($objDobaProducts, 'DobaProducts') && DobaInteraction::loadDobaProductsIntoDB($objDobaProducts)) {
                require_once 'doba/DobaLog.php';
                DobaLog::logProductApiLoad($objDobaProducts, 'success');
                header('Location: ' . FILENAME_DOBA_PRODUCTS . '?api=success');
                exit;
            } else {
                $msg = 'Your request could not be completed at this time.  Please try again later.';
            }
        } else {
            if ($api->hasErrors()) {
                $msg = 'Your request could not be completed due to the following errors:<br>- ' . implode('<br>- ', $api->getErrors());
            } else {
                $msg = 'Your request could not be completed at this time.  Please try again later.';
            }
        }
<?php

ini_set('include_path', ini_get('include_path') . ':' . $_SERVER['DOCUMENT_ROOT'] . '/admin/includes/');
include_once 'doba/DobaProductAPI.php';
$simple = "\r\n<dce>\r\n  <response>\r\n    <outcome>success</outcome>\r\n    <products>\r\n      <product>\r\n        <product_id>51696</product_id>\r\n        <title>a</title>\r\n        <description>&lt;li&gt;Allows accessories to be in neat application&lt;li&gt;Automatic switching to the active device without connecting and reconnecting&lt;li&gt;Matches with Playstation 2&#x99; unit</description>\r\n        <product_sku>GEPS2CS</product_sku>\r\n        <brand>GAME ELEMENTS</brand>\r\n        <condition>new</condition>\r\n        <freight>a</freight>\r\n        <ship_width>8</ship_width>\r\n        <ship_length>11</ship_length>\r\n        <ship_height>4</ship_height>\r\n        <ship_weight>2.16</ship_weight>\r\n        <ship_cost>10.49</ship_cost>\r\n        <items>\r\n          <item>\r\n            <item_id>64670</item_id>\r\n            <supplier_id>a</supplier_id>\r\n            <name>PS2&reg; Command Stand 2-in-1</name>\r\n            <item_sku>GEPS2CS</item_sku>\r\n            <map>0.00</map>\r\n            <price>25.08</price>\r\n            <prepay_price>24.00</prepay_price>\r\n            <msrp>49.95</msrp>\r\n            <qty_avail>3</qty_avail>\r\n            <stock>in-stock</stock>\r\n            <last_update>2008-02-20 17:06:10</last_update>\r\n          </item>\r\n        </items>\r\n        <images>\r\n          <image>\r\n            <url>http://images.doba.com/products/1/geps2cs.jpg</url>\r\n            <thumb_url>http://images.doba.com/products/1/_thumb/geps2cs.jpg</thumb_url>\r\n            <image_height>200</image_height>\r\n            <image_width>240</image_width>\r\n            <default>1</default>\r\n          </image>\r\n        </images>\r\n        <supplier_id>1</supplier_id>\r\n        <supplier_name>Alpha</supplier_name>\r\n        <supplier_processing>1-4 business days to ship out and receive tracking number.</supplier_processing>\r\n        <supplier_alerts>a</supplier_alerts>\r\n        <upc>026616065332</upc>\r\n        <supplier_notes>This supplier does not ship to Hawaii or Alaska. \r\n\r\nPlasma TVs are not eligible for return to Alpha. Most TV/Monitors 30&#x94;/projections products and Samsung TV&#x92;s 14&#x94; or larger to not qualify under normal Alpha Return Policy. Contact Samsung @ 1-800-SAMSUNG for service. Most TV&#x92;s/Monitors 30&#x94; or larger and projection products require in-field service repairs under manufacturer&#x92;s warranty. These products are not eligible for return. Please contact the appropriate manufacturer for troubleshooting repair service.</supplier_notes>\r\n        <supplier_drop_fee>2.50</supplier_drop_fee>\r\n        <product_group>basic</product_group>\r\n      </product>\r\n    </products>\r\n  </response>\r\n</dce>\r\n";
echo "<pre>";
$p = DobaProductAPI::parseProductDetails($simple);
print_r($p);
echo "</pre>";
<?php

ini_set('include_path', ini_get('include_path') . ':' . $_SERVER['DOCUMENT_ROOT'] . '/admin/includes/');
include_once 'doba/DobaApi.php';
include_once 'doba/DobaProductAPI.php';
$api = new DobaApi();
// change the following variables to have the data you wish to submit
$action = DOBA_API_ACTION_GETPRODUCTDETAIL;
$data = array('watchlist_id' => '94227');
// end fields to be changed
echo "<strong>Testing:</strong> " . $action . "<br><strong>With data:</strong><pre>";
print_r($data);
echo "</pre><strong>Result:</strong>";
if ($api->compileRequestXml($action, $data) && $api->sendRequest()) {
    echo " Successfully submitted<br><strong>Response XML:</strong><pre>";
    echo htmlentities($api->getResponseXml());
    $productList = DobaProductAPI::parseProductDetails($api->getResponseXml());
    var_dump($productList);
} else {
    if ($api->hasErrors()) {
        echo " Submission Failure, with errors<br><strong>Errors:</strong><pre>";
        print_r($api->getErrors());
    } else {
        echo " Submission Failure, no errors<br><strong>Object dump:</strong><pre>";
        var_dump($api);
    }
}
echo "</pre>";