-'.$obj->{'msg'}->{'desk'}); $model = ''; $spec = ''; $waranty_start = ''; $waranty_rem = ''; $pn = $obj['data']['machineInfo']['product']; $country = $obj['data']['machineInfo']['shipToCountry']; // only UA sn if ($country == 'UA' && strlen($pn) == 10) { $ui++; // ALL DATA $model = $obj['data']['machineInfo']['subSeries']; $spec = $obj['data']['machineInfo']['productName']; $spec = str_replace(array('NBLN ', 'NB LN '), '', $spec); // del lishnee $spec2 = $obj['data']['machineInfo']['specification']; $spec2 = substr($spec2, 0, strpos($spec2, 'SSD')); $spec2 = str_replace(array('AMD Ryzen™ 7', 'AMD Ryzen™7'), 'R7', $spec2); // del lishnee $spec2 = str_replace(array('AMD Ryzen™ 3', 'AMD Ryzen™3'), 'R3', $spec2); // del lishnee $spec2 = str_replace(array('AMD Ryzen™ 5', 'AMD Ryzen™5'), 'R5', $spec2); // del lishnee $spec2 = str_replace(array('Windows 11 Pro 64'), 'W11P', $spec2); // del lishnee $spec2 = str_replace(array("
Processor1x "), '', $spec2); // del lishnee $spec2 = str_replace(array('
Hard Drive1x ', '', '
Memory', ' - '), ' ', $spec2); // del lishnee $spec2 = str_replace(array(' vProÂ', '
', 'Processor', 'Generation ', '(EN:English,RU:Russian,UKR:Ukrainian)', 'Operating System', '™ ', 'AMD® ', 'AMD® ', 'Intel® ', 'Intel® ', 'Core® ', 'Intel™', 'Core™', '12th ', '13th ', '14th ', 'Memory', 'Hard Drive', ' 4800', '-4800', ' 3200', '-3200', ' 5500', '-5500', ' 5200', '-5200', '8400', '-8400', '™', '®', '™', 'Core™ ', 'Core® ', 'Core'), '', $spec2); // del lishnee $waranty_start = $obj['data']['currentWarranty']['startDate']; $waranty_rem = $obj['data']['currentWarranty']['remainingMonths']; $country = 'Ukraine'; // file_put_contents('ua_sn3.txt', $sern." - ".$model." ( ".$pn." ) ".$spec." - ".$waranty_rem." - ".$waranty_start.PHP_EOL, FILE_APPEND); file_put_contents('ua_sn4.txt', $sern." - ".$waranty_rem." - ".$waranty_start." - ".$model." ( ".$pn." ) "." -***- ".$spec2.PHP_EOL, FILE_APPEND); $now = date("Y-m-d H:i:s"); // $sql = "INSERT INTO `Lenovo`(`date_add`, `model`, `pn`, `sn`, `month`, `spec`, `date_sell`) // VALUES ('".$now."','".$model."','".$pn."','".$sern."','".$waranty_rem."','".$spec."','".$waranty_start."');"; // mysqli_query($link, $sql); } // if UA //echo( $obj['msg']['desc'].'

'); // sostoyanie zaprosa - Success //echo( $obj['data']['machineInfo']['subSeries'].'
'); // MODEL - LENOVO-V15-G3-IAP //echo( $obj['data']['machineInfo']['product'].'
'); // partnumber - 82TT00KWRA //echo( $obj['data']['machineInfo']['productName'].'
'); // short harakteristics - NBLN V15 G3 IAP I3 8G 8G 512G NOS //echo( $obj['data']['currentWarranty']['startDate'].'
'); // start date - 2021-11-24 //echo( $obj['data']['currentWarranty']['remainingMonths'].'
'); // termin gar v misiach zalyshok - 31 //echo( $obj['data']['machineInfo']['shipToCountry'].'


'); // UA file_put_contents('all_sn4.txt', $country." - ".$sern." - ".$model." ( ".$pn." ) ".$spec." - ".$waranty_rem." - ".$waranty_start.PHP_EOL, FILE_APPEND); } else { // !!!!!_ $skip_error++; // !!!!!_ file_put_contents('all_sn4.txt', "XXXX - ".$sern." - SKIP: ".$obj['msg']['desc'].PHP_EOL, FILE_APPEND); // !!!!!_ if ($skip_error > 300) { $mess = 'SKIP 300 seq: '.date('d-m h:i:s')." - i: ".$i." - SN: ".$sern." - UA: ".$ui; sendt($mess); $fileq = "stop4.txt"; if (!file_exists($fileq)) { $fpq = fopen($fileq, "w"); // ("r" - ñ÷èòûâàòü "w" - ñîçäàâàòü "a" - äîáîâëÿòü ê òåêñòó),ìû ñîçäàåì ôàéë fwrite($fpq, " "); fclose($fpq); } die; // !!!!!_ } } // else $i++; // if ($i == 300) break; // pause êàæäûõ 10 ðàç // !!!!!_ if ($i % 10 == 0) { sleep (5); file_put_contents($file11, $sern); if (file_exists('stop4.txt')) die; if ($sern[4] !== $five) { file_put_contents('logt4.txt', date('d-m h:i:s')." - start SN: - ".$nach.$sern[4]." - UA: ".$ui.PHP_EOL, FILE_APPEND); $mess = date('d-m h:i:s')." - NEXT SN4: - ".$sern." - UA: ".$ui." - i: ".$i; sendt($mess); } $five = $sern[4]; } // !!!!!_ } // foreach //print_r($obj); $now = new DateTime(); $interval = $now->diff($start); echo("
"."Âðåìÿ ðàáîòû ïàðñåðà: " . $interval->format('%h÷ %iìèí %sñåê'). ' i: ' . $i); file_put_contents('logt4.txt', date('d-m h:i:s')." - FINISH - ".$interval->format('%h÷ %iìèí %sñåê'). ' i: ' . $i. ' ni: ' .$ni. " - UA: " . $ui .PHP_EOL, FILE_APPEND); mysql_close($link); unlink($file11); $mess = 'Finish bot: '.$file11; sendt($mess); file_put_contents('parsed.txt', $nach.PHP_EOL, FILE_APPEND); function generator_words($chars, $length, &$words, $prefix = '') { if (strlen($prefix) == $length) { $words[] = $prefix; return; } for ($i = 0; $i < strlen($chars); $i++) { generator_words($chars, $length, $words, $prefix . $chars { $i }); } return; } function sendt($text) { //define('_TL_BOT', '1050592470:AAELiCL5QGqTwvNZVs2mTm509o5zs5wIreI'); $data = array( 'chat_id' => 419975056, 'text' => $text, ); $curl = curl_init(); //ìóòèì êóðë-ìóðë â ïåðåìåííóþ. Äëÿ îòïðàâêè ïðåäïî÷òèòåëüíåå èñïîëüçîâàòü êóðë, íî ìîæíî è ÷åðåç file_get_contents åñëè ñåðâåð íå ïîääåðæèâàåò // curl_setopt($curl, CURLOPT_URL, 'https://api.telegram.org/bot1634411225:AAGPY1N1UFOjkXefCQ-QJmb0JlMjSK1R83M/sendMessage'); curl_setopt($curl, CURLOPT_URL, 'https://api.telegram.org/bot1050592470:AAELiCL5QGqTwvNZVs2mTm509o5zs5wIreI/sendMessage'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST'); //Îòïðàâëÿåì ÷åðåç POST curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); //Ñàìè äàííûå îòïðàâëÿåìûå curl_exec($curl); curl_close($curl); //Çàêðûâàåì êóðë } ?>