Esempio n. 1
0
$html_snippet = $_GET['value'];
$table_name = $_GET['tablename'];
//."_&_collectibles";  // have to use it later. this is used for spec table
//$table_name_currenttable ="bicycles"; // this will come from the post later
$product_id = $_GET['id'];
//$innerHtml = file_get_html($url);
$innerHtml = str_get_html($html_snippet);
//echo $html_snippet;
//echo $table_name;
//echo $product_id;
$ProductArray = NULL;
$SingleProduct = NULL;
$counter = 0;
foreach ($innerHtml->find('div[class=comp comp-product-specs]') as $mitem) {
    $SingleProduct = new productspec();
    $SingleProduct->SetProductID($product_id);
    foreach ($mitem->find('div[class=spec-section expanded]') as $item) {
        foreach ($item->find('div[class=spec-title-wrp]') as $item_title) {
            //echo $item_title;
            $SingleProduct->SetProductSpecType($item_title->plaintext);
        }
        foreach ($item->find('div[class=spec-body]') as $item_body) {
            if ($item_body->find('ul')) {
                $type_list_data_combined = "";
                foreach ($item_body->find('ul li') as $item_spec_li_data) {
                    //echo "This list data: ". $item_spec_li_data;
                    $type_list_data_combined .= $item_spec_li_data->plaintext . ",";
                }
                //echo "List Combined data : ". $type_list_data_combined;
                $SingleProduct->SetProductData(rtrim($type_list_data_combined, ","));
            } else {