The XML comes from the categories api of ebay. Here is a small sample of it:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<GetCategoriesResponse xmlns="urn:ebay:apis:eBLBaseComponents">
<Timestamp>2009-05-10T17:53:51.069Z</Timestamp>
<Ack>Success</Ack>
<Version>615</Version>
<Build>e615__Bundled_8694629_R1</Build>
<CategoryArray>
<Category>
<BestOfferEnabled>true</BestOfferEnabled>
<CategoryID>6000</CategoryID>
<CategoryLevel>1</CategoryLevel>
<CategoryName>eBay Motors</CategoryName>
<CategoryParentID>6000</CategoryParentID>
<LSD>true</LSD>
</Category>
</GetCategoriesResponse>
Code: Select all
$selected_category = $_GET['category'];
$categories_xml = simplexml_load_file($_APPLICATION['ebay_categories_cache_filename']);
$xml_category_path = "/GetCategoriesResponse/CategoryArray/Category[CategoryID=$selected_category]";
$matching_categories = $categories_xml->xpath($xml_category_path);
if ($matching_categories) {
echo "Found {$matching_categories[0]->CategoryName}<br />";
} elseif ($matching_categories == false) {
echo "Returned false!";
} else {
// dumped variables here
}