Merhaba arkadaşlar,

sistemi sıfırdan yazıp sizle paylaşmak istedim.buyrun kodlar ve uygulamalı örneği

sınıf kodlarımız ;

<?php
	/**
	*
	* Garanti İç Piyasa Botu
	*
	* @author: saintx (Ogün KARAKUŞ)
	* @date: 25.11.2012
	* @web: http://saintx.net/
	**/
	
	class PIYASALAR {
		/* Class Constant(s) */
		const URL = 'http://realtime.paragaranti.com/asp/xml/icpiyasa.asp';
		
		/* Class Variable(s) */
		public $xml_data;
		public $values;
		
		/* Class Method(s) */
		public function __construct() {
			$this->xml_data = $this->objects_into_array(simplexml_load_string($this->html(PIYASALAR::URL, true, 'ISO-8859-9', 'UTF-8')));
			$this->values = $this->fetch_xml_data($this->xml_data['STOCK']);
		}
		
		public function objects_into_array($arrObjData, $arrSkipIndices = array())
		{
			$arrData = array();
			if(is_object($arrObjData)) {
				$arrObjData = get_object_vars($arrObjData);
			}
			
			if (is_array($arrObjData)) {
				foreach ($arrObjData as $index => $value) {
					if(is_object($value) || is_array($value)) {
						$value = $this->objects_into_array($value, $arrSkipIndices);
					}
					if(in_array($index, $arrSkipIndices)) {
						continue;
					}
					$arrData[$index] = $value;
				}
			}
			return $arrData;
		}
		
		public function fetch_xml_data($xml_data) {
			return array(
				'P_DOLAR' => array(
					'LAST'  => $xml_data[1]['LAST'],
					'PERNC' => $xml_data[1]['PERNC']
				),
				'P_EURO' => array(
					'LAST'  => $xml_data[2]['LAST'],
					'PERNC' => $xml_data[2]['PERNC']
				),
				'P_STERLIN' => array(
					'LAST'  => $xml_data[3]['LAST'],
					'PERNC' => $xml_data[3]['PERNC']
				),
				'P_GOLD' => array(
					'LAST'  => $xml_data[4]['LAST'],
					'PERNC' => $xml_data[4]['PERNC']
				),
				'P_IMKB' => array(
					'LAST'  => $xml_data[0]['LAST'],
					'PERNC' => $xml_data[0]['PERNC']
				),
			);
		}
		
		public function html($url, $iconv=false, $iconv_in_charset=null, $iconv_out_charset=null) {
			return ($iconv) ? iconv($iconv_in_charset, $iconv_out_charset, @file_get_contents($url)) : @file_get_contents($url);
		}
	}
?>
kullanımı ;
<?php
	$PIYASALAR = new PIYASALAR;
	
	echo 'DOLAR => <br />Şuanki alış değeri =>'.$PIYASALAR->values['P_DOLAR']['LAST'].'<br />Yükselme Değeri =>'.$PIYASALAR->values['P_DOLAR']['PERNC'].'<br />';
?>