function curl_phaseOne($site_id, $linkXpath, $catXpath) { iniDOM::get_links($linkXpath); iniDOM::get_categories($catXpath); $counter = 1; foreach ($this->arr['links'] as $link) { $link = trim($this->arr['links'][$counter]); $category = trim($this->arr['categories'][$counter]); if (!empty($link) && !empty($category)) { $result = $this->db->select('*', 'sub_category', "sub_cat_name =\"{$category}\""); if ($result->num_rows == 0) { $this->db->insert('sub_category', "'',\"{$category}\""); $result = $this->db->select('sub_cat_id', 'sub_category', "sub_cat_name =\"{$category}\""); $result = mysqli_fetch_assoc($result); $cat_id = $result['sub_cat_id']; } else { $result = mysqli_fetch_assoc($result); $cat_id = $result['sub_cat_id']; } $result = $this->db->select('*', 'url', "supplier_url = '{$link}'"); if ($result->num_rows == 0) { $this->db->insert('url', "'','{$link}','{$cat_id}','{$site_id}'"); } } $counter++; } }