예제 #1
0
 function xquery($path)
 {
     iniDOM::initiate_cURL($this->url);
     iniDOM::load_xpath();
     return $this->result = $this->Xpath->query($path);
 }
예제 #2
0
파일: iniDOM.php 프로젝트: Chilldev/Crawl
 function curl_phaseTwo($pname, $urls, $price, $img, $site_id, $cat_id)
 {
     iniDOM::get_names($pname);
     iniDOM::product_url($urls);
     iniDOM::get_prices($price);
     iniDOM::get_images($img);
     $counter = 1;
     foreach ($this->arr['pro_names'] as $nameo) {
         $name = @trim($this->arr['pro_names'][$counter]);
         $price = @trim($this->arr['prices'][$counter]);
         $image = @trim($this->arr['images'][$counter]);
         $url = @trim($this->arr['urls'][$counter]);
         $result = $this->db->select('*', 'product', "name = \"{$name}\"");
         if ($result->num_rows == 0) {
             $this->db->insert('product(name,sub_cat_id)', "\"{$name}\",\"{$cat_id}\"");
             $result = $this->db->select('*', 'product', "name = \"{$name}\"");
             $result = mysqli_fetch_assoc($result);
             $pro_id = $result['id'];
             $this->db->insert('pro_location(price,supp_id,pro_id,product_url,img_url)', "'{$price}','{$site_id}','{$pro_id}','{$url}','{$image}'");
         } else {
             $result = mysqli_fetch_assoc($result);
             $pro_id = $result['id'];
             $this->db->insert('pro_location(price,supp_id,pro_id,product_url,img_url)', "'{$price}','{$site_id}','{$pro_id}','{$url}','{$image}'");
         }
         $counter++;
     }
     return 1;
 }