Location: PHPKode > scripts > Post Danmark > post-danmark/postdanmark.class.php
<?

class postdanmark {

	var $stregkode;
	var $result;

	function track($stregkode) {
	
		$this->stregkode = $stregkode;
		$url = "http://www.postdanmark.dk/tracktrace/TrackTrace.do?i_lang=IND&i_stregkode=".$this->stregkode;
		
		$html = implode("\n",file($url));
		$htmlstart = strpos($html,"<tbody>");
		$htmlend = strpos($html,"</tbody>",$htmlstart);
		$htmllen = $htmlend - $htmlstart;
		
		$chunk = substr($html,$htmlstart,$htmllen);	
		$elements = explode('<tr>',$chunk);
		
		for($i=1;$i<count($elements);$i++){
			$we = explode("\n",strip_tags($elements[$i]));
			
			$ret[$i-1]['date'] = trim(str_replace("&nbsp;","",$we[2]));
			$ret[$i-1]['time'] = trim(str_replace("&nbsp;","",$we[4]));
			$ret[$i-1]['status'] = trim(str_replace("&nbsp;","",$we[6]));						
		}
			
		$this->result = $ret;	
		
	}

}


?>
Return current item: Post Danmark