Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $sellerId = 3;
- include("../../amzing.class.php");
- function apiDebug($html) {
- $hh = fopen("CAZZO.txt", "a");
- fwrite($hh, $html . "\n\n\n--------------------------------------\n\n\n");
- fclose($hh);
- print $html;
- }
- $Amzing = new Amzing;
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "https://www.amz-review.com/api/?username=sganga.i1&password=123456&action=getproducts&nation=IT1&format=jsongetproducts");
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HEADER, false);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
- curl_setopt($ch, CURLOPT_TIMEOUT, 30);
- $Products = json_decode(curl_exec($ch), true);
- curl_close($ch);
- if(!$Products)
- die("not json");
- $currentProducts = $Amzing->getProductsBySellerId($sellerId);
- print_r($Products);
- $toRemove = Array();
- foreach($currentProducts as $Asin => $currentProduct) {
- if(!isset($Products[$Asin]))
- $toRemove[] = $Asin;
- }
- foreach($toRemove as $ASIN) {
- if(!$Amzing->disableProduct($Asin, $sellerId))
- apiDebug("BORDELLO! PRODOTTO {$ASIN} NON SI E' DISABILITATO E NON CI SONO QUANTITA'!");
- }
- foreach($Products as $Asin => $Product) {
- if($Product['fees'] == "YES" and $Product['pieces'] > 1) {
- if(isset($currentProducts[$Asin]))
- $Amzing->updateProductQty($Asin, $sellerId, $Product['pieces'], $Product['pieces'], $Product['pieces']);
- else {
- if(!$Amzing->getProductFromASIN($Asin, "IT"))
- $Amzing->insertProduct("IT", $Product['product'], $Asin, "", $Product['pieces'], $Product['pieces'], $Product['pieces'], 100, htmlentities($Product['note']), "", 18, $sellerId, 1, "francescosg0e-21", 0);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement