Esempio n. 1
0
 public function go()
 {
     $products = ProductDB::getAll();
     $i = 1;
     foreach ($products as $product) {
         $id = $product->id;
         $img = $this->getName();
         exec("wget -O img/product/" . $img . " " . $product->img);
         //http://abumba.ru/image/cache/data/FSA-products/box/box_red-600x600.png");
         $curl = curl_init();
         curl_setopt($curl, CURLOPT_URL, 'http://www.mama-pa.ru/api.php');
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($curl, CURLOPT_POST, true);
         $str = "action=setp&category_id=" . $product->category_id . "&img=" . $img . "&brand_id=" . $product->brand_id . "&price=" . $product->price . "&title=" . $product->title . "&meta_desc=" . $product->meta_desc . "&meta_key=" . $product->meta_key . "&available=" . $product->available;
         curl_setopt($curl, CURLOPT_POSTFIELDS, $str);
         $out = curl_exec($curl);
         echo $out . "<br />";
         curl_close($curl);
         $i++;
     }
     echo "<br /><br /><br /> Всего: " . $i++;
 }