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

Requests:
 Headlines
 Symbol News
 Category News
 Most Actives
 Summary Teaser
 Summary
Sample Code:
 Coldfusion
 ASP
 JSP
 PHP
 Perl
 
Perl
Extensive Perl support for wddx is available using the WDDX SDK The example below was drawn from the SDK and modified by FinWin programmers who only know a little Perl. If you find it in error, please contact FinWin immediately with your tested Perl code.

Perl Example
	#!/usr/bin/perl
	use WDDX;

	my(%pXML);
         # Create a user agent object
         use LWP::UserAgent;
         $ua = new LWP::UserAgent;
         $ua->agent("AgentName/0.1 " . $ua->agent);

         # Create a request
         my $req = new HTTP::Request POST =>'http://www.finwin.com/processct/processnewstag.cfm';
         $req->content_type('application/x-www-form-urlencoded');
         $req->content('username=myUsername&passord=myPassword&request=headlines&id=1183&type=query');

         # Pass request to the user agent and get a response back
         my $res = $ua->request($req);

         # Check the outcome of the response
         if ($res->is_success) {
             print $res->content;
         } else {
             print "Error retrieving content\n";}
	
	$parser = new wddx();

	$parser->parsefile($res);
	
	$arrayRef = $parser->cfwddx('action' => 'wddx2perl'	);
	
	%hsh = %{@{$arrayRef}[0]};

	print "After the xml parsing:\n";
	
	# the hash (associative array) WDDXPROPERTIES has several values you can use.
	# They are RECORDCOUNT - number of records, FIELDCOUNT - number of columns, FIELDNAMES - the column names.
		
	print "Record Count = $hsh{'WDDXPROPERTIES'}{'RECORDCOUNT'}\n";
	print "Field Count  = $hsh{'WDDXPROPERTIES'}{'FIELDCOUNT'}\n";
	print "Field Names  = @{$hsh{'WDDXPROPERTIES'}{'FIELDNAMES'}}\n";
	print "The 2nd Field is named @{$hsh{'WDDXPROPERTIES'}{'FIELDNAMES'}}[1]\n\n";
	
	# to access the data, iterate through each row using the "RECORDCOUNT" 
	# Each column in the 
	
	for ($i = 0; $i < $hsh{'WDDXPROPERTIES'}{'RECORDCOUNT'}; $i++) 
	{
		for($ii = 0; $ii < $hsh{'WDDXPROPERTIES'}{'FIELDCOUNT'}; $ii++)
		{
			$thisfield	=  @{$hsh{'WDDXPROPERTIES'}{'FIELDNAMES'}}[$ii];
			
			print "\t $thisfield  IS  $hsh{$thisfield}[$i]\n";

		}
	}

	exit;


	

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