<?php
class ParsNalog
{
private $url_pars;
private $ch;
public $numberOGRN;
public function __construct($print = false) {
$headers = array (
"accept:application/json, text/javascript, */*; q=0.01",
"accept-language:ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7",
"cache-control:no-cache",
"content-type:application/x-www-form-urlencoded",
"pragma:no-cache",
"sec-fetch-mode:cors",
"sec-fetch-site:same-origin",
"x-requested-with:XMLHttpRequest"
);
$body = "mode=quick&page=1&query=1192225018655&pageSize=10&sortField=NAME_EX&sort=ASC";
$this->ch = curl_init();
if (!$print) {
curl_setopt($this->ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36');
curl_setopt($this->ch, CURLOPT_REFERER, "https://ofd.nalog.ru/index.html");
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true);
}
}
public function set($name, $value) {
curl_setopt($this->ch, $name, $value);
return $this;
}
public function exec($url_pars) {
curl_setopt($this->ch, CURLOPT_URL, $url_pars);
return curl_exec($this->ch);
}
public function __destruct() {
curl_close($this->ch);
}
}
public static function checkExistsCompanyRegisterSandMEnterprises () {
$obParseData = new ParsNalog();
$url_pars = 'https://ofd.nalog.ru/index.html#pnlSearchResult';
$obPQDoc = phpQuery::newDocument($obParseData->exec($url_pars));
$obPQDoc->find('#tblResultData');
$strValueFindData = pq($obPQDoc);
echo '<<<<< '. $strValueFindData->find('.rsmp-result span')->text() .' >>>>>';
//var_dump($strValueFindData);
}
curl "https://ofd.nalog.ru/search-proc.json"
- H "Sec-Fetch-Mode: cors"
- H "Origin: https://ofd.nalog.ru"
- H "Accept-Encoding: gzip, deflate, br"
- H "Accept-Language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7"
- H "X-Requested-With: XMLHttpRequest"
- H "Cookie: _ym_uid=1559550956125437272; _ym_d=1559550956; _ga=GA1.2.899122039.1560429815; top100_id=t1.-1.760106474.1561622629137; last_visit=1567586822127::1567597622127; _ym_isad=2; _ym_visorc_23729197=w; JSESSIONID=B01A40C97FA5EDF96137A187C59315A1" - H "Connection: keep-alive" - H "Pragma: no-cache" - H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" - H "Content-Type: application/x-www-form-urlencoded" - H "Accept: application/json, text/javascript, */*; q=0.01" - H "Cache-Control: no-cache" - H "Referer: https://ofd.nalog.ru/index.html" - H "Sec-Fetch-Site: same-origin"--data "mode=quick^&page=^&query=5187746013934^&pageSize=10^&sortField=NAME_EX^&sort=ASC"--compressedcurl "https://ofd.nalog.ru/search-proc.json" - H "Sec-Fetch-Mode: cors" - H "Origin: https://ofd.nalog.ru" - H "Accept-Encoding: gzip, deflate, br" - H "Accept-Language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7" - H "X-Requested-With: XMLHttpRequest" - H "Cookie: _ym_uid=1559550956125437272; _ym_d=1559550956; _ga=GA1.2.899122039.1560429815; top100_id=t1.-1.760106474.1561622629137; last_visit=1567586822127::1567597622127; _ym_isad=2; _ym_visorc_23729197=w; JSESSIONID=B01A40C97FA5EDF96137A187C59315A1"
- H "Connection: keep-alive"
- H "Pragma: no-cache"
- H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36"
- H "Content-Type: application/x-www-form-urlencoded"
- H "Accept: application/json, text/javascript, */*; q=0.01"
- H "Cache-Control: no-cache"
- H "Referer: https://ofd.nalog.ru/index.html"
$url_pars = 'mode=quick^&page=^&query=' . $ogrn . '^&pageSize=10^&sortField=NAME_EX^&sort=ASC';
public static function checkExistsCompanyRegisterSandMEnterprises ($url_pars) {
$obParseData = new Pars();
$obPQDoc = phpQuery::newDocument($obParseData->exec($url_pars));
$obPQDoc->find('#tblResultData');
$strValueFindData = pq($obPQDoc);
var_dump($strValueFindData);
}
<?php
class Pars
{
private $url_pars;
private $ch;
public function __construct($print = false) {
$headers = array (
"Content-Type:text/html; charset=utf-8",
);
$this->ch = curl_init();
if (!$print) {
curl_setopt($this->ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36');
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true);
}
}
public function set($name, $value) {
curl_setopt($this->ch, $name, $value);
return $this;
}
public function exec($url_pars) {
curl_setopt($this->ch, CURLOPT_URL, $url_pars);
return curl_exec($this->ch);
}
public function __destruct() {
curl_close($this->ch);
}
}
public static function checkExistsCompanyRegisterSandMEnterprises () {
$obParseData = new Pars();
$url_pars = 'https://ofd.nalog.ru/index.html#pnlSearchResult';
$obPQDoc = phpQuery::newDocument($obParseData->exec($url_pars));
$obPQDoc->find('#tblResultData');
$strValueFindData = pq($obPQDoc);
var_dump($strValueFindData);
}
mode=quick^&page=^&query=1192225018655^&pageSize=10^&sortField=NAME_EX^&sort=ASC
$url_pars = 'mode=quick^&page=^&query=1192225018655^&pageSize=10^&sortField=NAME_EX^&sort=ASC';
curl "https://ofd.nalog.ru/search-proc.json"
- H "Sec-Fetch-Mode: cors"
- H "Origin: https://ofd.nalog.ru"
- H "Accept-Encoding: gzip, deflate, br"
- H "Accept-Language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7"
- H "X-Requested-With: XMLHttpRequest"
- H "Cookie: _ym_uid=1559550956125437272; _ym_d=1559550956; _ga=GA1.2.899122039.1560429815; top100_id=t1.-1.760106474.1561622629137; last_visit=1567586822127::1567597622127; _ym_isad=2; _ym_visorc_23729197=w; JSESSIONID=B01A40C97FA5EDF96137A187C59315A1" - H "Connection: keep-alive" - H "Pragma: no-cache" - H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" - H "Content-Type: application/x-www-form-urlencoded" - H "Accept: application/json, text/javascript, */*; q=0.01" - H "Cache-Control: no-cache" - H "Referer: https://ofd.nalog.ru/index.html" - H "Sec-Fetch-Site: same-origin"--data "mode=quick^&page=^&query=5187746013934^&pageSize=10^&sortField=NAME_EX^&sort=ASC"--compressedcurl "https://ofd.nalog.ru/search-proc.json" - H "Sec-Fetch-Mode: cors" - H "Origin: https://ofd.nalog.ru" - H "Accept-Encoding: gzip, deflate, br" - H "Accept-Language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7" - H "X-Requested-With: XMLHttpRequest" - H "Cookie: _ym_uid=1559550956125437272; _ym_d=1559550956; _ga=GA1.2.899122039.1560429815; top100_id=t1.-1.760106474.1561622629137; last_visit=1567586822127::1567597622127; _ym_isad=2; _ym_visorc_23729197=w; JSESSIONID=B01A40C97FA5EDF96137A187C59315A1"
- H "Connection: keep-alive"
- H "Pragma: no-cache"
- H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36"
- H "Content-Type: application/x-www-form-urlencoded"
- H "Accept: application/json, text/javascript, */*; q=0.01"
- H "Cache-Control: no-cache"
- H "Referer: https://ofd.nalog.ru/index.html"
- H "Sec-Fetch-Site: same-origin"--data "mode=quick^&page=^&query=1192225018655^&pageSize=10^&sortField=NAME_EX^&sort=ASC"--compressed
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $body);