Demo entry 6499770

A php code

   

Submitted by anonymous on May 30, 2017 at 10:17
Language: PHP. Code size: 1.3 kB.

<?php
	$date = date("d.m.Y", time() - (60*60*24));
	$address = "http://zakupki.gov.ru/epz/order/extendedsearch/results.html?searchString=&morphology=on&openMode=USE_DEFAULT_PARAMS&pageNumber=1&sortDirection=false&recordsPerPage=_10&showLotsInfoHidden=false&fz44=on&fz223=on&currencyId=1&publishDateFrom=".$date."&publishDateTo=".$date."&customerTitle=КОМИТЕТ+ПО+ИНФОРМАТИЗАЦИИ+И+СВЯЗИ&customerCode=01722000061&customerFz94id=692402&customerFz223id=&customerInn=7825457753&af=on&ca=on&sortBy=UPDATE_DATE";
	
	$html = file_get_contents($address);
	$DOM = new DOMDocument;
	$DOM->loadHTML($html);
	
	$divs = $DOM->getElementsByTagName('div');
	$parent = null;
	foreach($divs as $div) {
		if($div->getAttribute('class') === 'parametrs margBtm10') {
			$parent = $div;
			break;
		}
   	}
	
	if($parent == null) { echo "Error, parent not found!"; exit; }

	$divs = $parent->getElementsByTagName('div');
	$tenders = array();
	foreach($divs as $div) {
		if($div->getAttribute('class') === 'registerBox registerBoxBank margBtm20') {
			$tenders[] = $div;
		}
   	}
   	
	$mail = "h1karo@outlook.com"; // почта, на которую будет отправлено сообщение
	if(count($tenders) != 0) {
		mail($mail, "Мониторинг тендеров", "Появились новые тендеры за ".$date.": ".$address);
	} else { exit; }
?>

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).