<?php
		session_start();
		$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
		$arr = explode("?", $actual_link, 2);
		$current_url = $arr[0];
		$url=str_replace("info.php","checkrules.php",$current_url);
		$point_id=7;
		$bquaadtag_id=4;
		$scope2_id=-1;
		$scope_id=1;
		$params= array(
			'id' => $point_id,
			'tag_id' => $bquaadtag_id,
			'scope_id' => $scope_id,
			'scope2_id' => $scope2_id			
		);

		$strCookie = 'eoQUAL=' . $_COOKIE['eoQUAL'] . '; path=/';
		$useragent = $_SERVER['HTTP_USER_AGENT'];
		session_write_close();
		$ch = curl_init($url);


		curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		//curl_setopt($ch, CURLOPT_HEADER, 1);

		curl_setopt($ch,CURLOPT_USERAGENT, $useragent);
		curl_setopt( $ch, CURLOPT_COOKIE, $strCookie );

		$result = curl_exec($ch);
//$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
//$header = substr($response, 0, $header_size);
//echo $header;
		curl_close($ch);
		

		session_start();
		$xml = new SimpleXMLElement($result);
		$result = $xml->xpath('//entity');
		
		foreach ($result as $node)
		{
						
			$attrs=$node->attributes();
			/*
			foreach($attrs as $attr => $val) {
				echo $attr."=".$val;
			}*/
		
			$docs=$node->xpath('document');
			
			foreach($docs as $doc)
			{							
				$doc_attrs=$doc->attributes();
				foreach($doc_attrs as $docattr => $val_doc)
				{
					echo $docattr.="=".$val_doc;
					$doc_id=-1;
					$realfname="";
					$filename="";
					if($docattr=="docid")
						$doc_id = $val_doc;
					if($docattr=="realfname")
						$realfname=$val_doc;
					if($docattr=="file")
						$filename=$val_doc;
				}
			}
			
		}
		/*$r2=$xml->xpath('//document/@docid');
		foreach($r2 as $node2)
		{
			echo ' docid: ',$node2,"\n";
		}*/
		

?>