<?php
	# Sınıfı dahil ettik.
	require('class.saintx.php');
	# Nesnemizi oluşturduk.
	$SAINTX = new SAINTX();
	# "Koç" burcuna ait yorumu getirmesini söyledik.
	$horoscope_comment = $SAINTX->getHoroscopeComment('koc');
	# Yorumu ekrana yazdırdık.
	echo $horoscope_comment;
?>
class.saintx.php dosyası;
<?php
	
	/* 
	 * SAINTX > POSTA.COM.TR Astroloji Botu
	 * 
	 * @author: SAINTX
	 * @web: http://saintx.net
	 * @mail: im@saintx.net
	 * @date: 25.06.2013
	 */
	
	class SAINTX {
		const AUTHOR = 'SAINTX';
		const POSTA_COM_TR_ASTROLOJI_SERVICE_URL = 'http://www.posta.com.tr/astroloji';
		
		public $horoscopes = array('koc', 'boga', 'ikizler', 'yengec', 'aslan', 'basak', 'terazi', 'akrep', 'yay', 'oglak', 'kova', 'balik');
		public $current_horoscope = null;
		public $horoscope_comments = array();
		public $posta_com_tr_request_uri = null;
		public $posta_com_tr_request_uri_query_string = null;
		
		const REGEX_1 = '#<p\sclass="ozet">(.*?)<\/p>#si';
		
		public function __construct() {
			$this->getHoroscopeComments();
		}
		
		public function buildRequestQueryString() {
			$this->posta_com_tr_request_uri_query_string = DIRECTORY_SEPARATOR.$this->current_horoscope.DIRECTORY_SEPARATOR;
			
			return $this->posta_com_tr_request_uri_query_string;
		}
		
		public function buildRequestURI() {
			$this->posta_com_tr_request_uri = static::POSTA_COM_TR_ASTROLOJI_SERVICE_URL.$this->posta_com_tr_request_uri_query_string;
			
			return $this->posta_com_tr_request_uri;
		}
		
		public function setCurrentHoroscope($horoscope) {
			$this->current_horoscope = $horoscope;
		}
		
		public function getRequestURI() {
			return $this->posta_com_tr_request_uri;
		}
		
		public function getHoroscopeComments() {
			foreach($this->horoscopes as $horoscope) {
				$this->setCurrentHoroscope($horoscope);
				$this->buildRequestQueryString();
				$this->buildRequestURI();
				$html = $this->html($this->getRequestURI());
				$horoscope_comment = preg_match(static::REGEX_1, $html, $matches) ? end($matches) : '';
				$this->horoscope_comments[$horoscope] = $horoscope_comment;
			}
		}
		
		public function getHoroscopeComment($horoscope) {
			return $this->horoscope_comments[$horoscope];
		}
		
		public function html($url, $iconv=false, $iconv_in_charset='', $iconv_out_charset='') {
			return ($iconv) ? iconv($iconv_in_charset, $iconv_out_charset, @file_get_contents($url)) : @file_get_contents($url);
		}
	}
	
?>