| gif | history | intraday | java | news | objects | options | quote | soap | spots | tickers | weather | end of day | wddx |

Request:
 Ticks
Sample Code:
 Coldfusion
 ASP
 JSP
 PHP
 Perl
 
PHP
Starting with PHP 3, wddx support has been available. The on-line docs for PHP with wddx can be found at http://www.php.net/manual/ref.wddx.php3.

FinWin owes it's thanks to Vladimir Volosnikov from http://www.3steps.com for the excellent and concise example found below.

<?
#  --------------------------  CREDIT  --------------------------
#  Example written by Vladimir Volosnikov
#  --------------------------------------------------------------
////////////////////////////////////////MAIN PIECE////////////////////////////////////////////////
	$obj = new mPost( );
	$value = array( );

	$tempQuery = "username=USERNAME&password=PASSWORD&id=ID&request=ticks&type=query&symbol=msft&count=10";
	$obj->setValue("host", "www.finwin.com");
	$obj->setValue("path", "/processct/processTickHistory.cfm");
	$obj->setValue("queryString", $tempQuery);
	$Contents = $obj->doPost( );
	$Contents = substr($Contents, strpos($Contents, '<wddxPacket'));
	$value = wddx_deserialize($Contents);

	//For this request we expect 10 records back. If less then that, error happened
	if(sizeof($value[DATE]) > 1){
		echo "Success<br>";
		echo "<BR><BR><BR>Below is array with all data<br>\n";
		print_r($value);
	}else{
	   echo "There was an Error";
	}
////////////////////////////////////////MAIN PIECE////////////////////////////////////////////////
class mPost
{
	var $reqArray;

	//////////////////////////////////////////////////////////////////////////////////////
	function setValue($what, $val=0){
		if(!is_array($this->reqArray))
			$this->reqArray = array( );
		$this->reqArray[strtoupper($what)] = $val;
	}
	
	//////////////////////////////////////////////////////////////////////////////////////
	function getValue($what){
		return $this->reqArray[strtoupper($what)];
	}
	
	//////////////////////////////////////////////////////////////////////////////////////
	function doPost( ){
		$fp = fsockopen($this->getValue('host'),80);
		fputs($fp, "POST " . $this->getValue('path') . " HTTP/1.1\n");
		fputs($fp, "Host: $this->getValue('host') \n");
		fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
		fputs($fp, "Content-length: ". strlen($this->getValue('querystring')) . "\n");
		fputs($fp, "Connection: close\n\n");
		fputs($fp, $this->getValue('querystring'));
		while(!feof($fp))
				$res .= fgets($fp, 128);
		fclose($fp);
		return $res;
	}
	//////////////////////////////////////////////////////////////////////////////////////
}
?>

DTN Market Access
9110 West Dodge Road, Suite 200   Omaha, Nebraska 68114
Copyright 2012, All rights reserved