We help IT Professionals succeed at work.

Yahoo Stock Quote Feed not working

robertmayhue_iii
on
1,346 Views
Last Modified: 2012-05-10
I have a stock market feed on a webpage and it uses the Yahoo Finance csv file feeds via xml. For months it has been working fine. Recently the Dow Jones feed has been giving me a "subscript out of range error". In my code its the feed in the obj reference. The Nasdaq (obj2) and NYSE (obj6) feeds are fine. I even tried using the following link in the code for obj: http://finance.yahoo.com/d/quotes.csv?s=%5EDJI&f=sl1d1t1c1ohgv&e=.csv but I get an access denied error. Has Yahoo changed something or do I need to update the link in some way?
<%
Dim obj,obj2,obj6

Set obj = Server.CreateObject("MSXML2.XMLHTTP")
obj.Open "GET", "http://download.finance.yahoo.com/d/quotes.csv?s=%5EDJI&f=sl1d1t1c1ohgv&e=.csv", false
obj.Send
resp = obj.ResponseText
set obj = nothing

Set obj2 = Server.CreateObject("MSXML2.XMLHTTP")
obj2.Open "GET", "http://download.finance.yahoo.com/d/quotes.csv?f=sl9d1t1c1cohgvabjknpx&s=^IXIC", false
obj2.Send
resp2 = obj2.ResponseText
set obj2 = nothing

Set obj6 = Server.CreateObject("MSXML2.XMLHTTP")
obj6.Open "GET", "http://download.finance.yahoo.com/d/quotes.csv?f=sl9d1t1c1cohgvabjknpx&s=^NYA", false
obj6.Send
resp6 = obj6.ResponseText
set obj6 = nothing

dim lines,lines2,lines6 ' array for how many stocks
lines=split(resp,Chr(10))

lines2=split(resp2,Chr(10))

lines6=split(resp6,Chr(10))

contents = split(lines(i),",")  ' array for items in each line
contents2 = split(lines2(i),",")  ' array for items in each line
contents6 = split(lines6(i),",")  ' array for items in each line

sTemp=sTemp &"<Stock><Symbol>" &contents(0)&"</Symbol>"
sTemp=sTemp &"<Last>" &contents(1) &"</Last>"
sTemp=sTemp&"<Date>"&contents(2)&"</Date>"
sTemp=sTemp&"<Time>"&contents(3)&"</Time>"
sTemp=sTemp&"<Change>"&contents(4)&"</Change>"

%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body>
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table29">
								<tr>
									<td class="nextstepsheadercolor" background="../includes/images/backgrey2.gif" height="27" style="border-top: 1px solid #c8c8c8">
									<p align="left"><b><font size="2">&nbsp;</font>Current 
									Market Activity</b></td>

								</tr>
								<tr>
									<td class="nextstepsheadercolor">


<table border="0" width="180" cellspacing="0" id="table32">


	<tr>
		<td bgcolor="#F0F0F0" style="border:1px solid #C8C8C8; ">
		<table border="0" cellspacing="0" cellpadding="0" width="100%" id="table33" style="border-left-width: 0px; border-right-width: 0px; border-top-width: 0px">
			
									
					
					
			<tr>
				<td style="border-bottom: 1px solid #C0C0C0; ; border-left-width:medium; border-right-width:medium; border-top-width:medium" width="54" align="center" height="19" bgcolor="#f8f4e9">
				<b><font size="1" face="Verdana">Index</font></b></td>
				<font face="Verdana">
				<td style="border-bottom: 1px solid #C0C0C0; ; border-right-width:medium; border-left-color:#C8C8C8; border-left-width:medium; border-top-color:#C8C8C8; border-top-width:medium" width="53" align="center" height="19" bgcolor="#f8f4e9">
				<font size="1" face="Verdana"><b>Last</b></font></td>
				<td style="border-bottom: 1px solid #C0C0C0; ; border-right-width:medium; border-left-color:#C8C8C8; border-left-width:medium; border-top-color:#C8C8C8; border-top-width:medium" width="53" align="center" height="19" bgcolor="#f8f4e9">
				<b><font size="1" face="Verdana">Change</font></b></td>
			</tr>
			<tr>
				<td style="border-bottom:1px solid #C0C0C0; border-right-width: medium; ; border-top-width:medium; " width="54" align="center" bgcolor="#FFFFFF" height="25">
				<font color="#000000" size="1"><font color="#000000">NASDAQ</font></font></td>
				<td style="border-bottom:1px solid #C0C0C0; border-left-width: medium; border-right-width: medium; ; border-top-width:medium; " width="53" align="center" bgcolor="#FFFFFF" height="25">
				<font size="1"><%= FormatNumber(Replace(contents2(1), chr(34), ""),2) %></font></td>
				<td style="border-bottom:1px solid #C0C0C0; border-left-width: medium; border-right-width: medium; ; border-top-width:medium; " width="53" align="center" bgcolor="#FFFFFF" height="25">
				<font size="1"><%= Replace(contents2(4), chr(34), "") %><% If Replace(contents2(4), chr(34), "") > 0 Then %>
					<img border="0" src="/webff/other/images/up.gif" width="10" height="14">
					<% Else %>
					<img border="0" src="/webff/other/images/down.gif" width="10" height="14">
					<% End If %>
</font>
</td>
			</tr>
			<tr>
				<td style="border-right-width: medium; border-top-width: medium; border-bottom: 1px solid #C8C8C8; ; border-left-color:#C8C8C8; border-right-color:#C8C8C8; border-top-color:#C8C8C8" width="54" align="center" bgcolor="#F0F0F0" height="25">
				<font color="#000000" face="Verdana" size="1">DJIA</font></td>
				<td style="border-left-width: medium; border-right-width: medium; border-top-width: medium; border-bottom: 1px solid #C8C8C8; ; border-left-color:#C8C8C8; border-right-color:#C8C8C8; border-top-color:#C8C8C8" width="53" align="center" bgcolor="#F0F0F0" height="25">
				<font size="1"><%= FormatNumber(Replace(contents(1), chr(34), ""),2) %></font></td>
				<td style="border-left-width: medium; border-right-width: medium; border-top-width: medium; border-bottom: 1px solid #C8C8C8; ; border-left-color:#C8C8C8; border-right-color:#C8C8C8; border-top-color:#C8C8C8" width="53" align="center" bgcolor="#F0F0F0" height="25">
				<font size="1"><%= Replace(contents(4), chr(34), "") %><% If Replace(contents(4), chr(34), "") > 0 Then %>
					<img border="0" src="/webff/other/images/up.gif" width="10" height="14">
					<% Else %>
					<img border="0" src="/webff/other/images/down.gif" width="10" height="14">
					<% End If %>
</font>
</td>
			</tr>
			<tr>
				<td style="border-bottom:1px solid #C0C0C0; border-right-width: medium; border-top-width: medium; ; " width="54" align="center" bgcolor="#FFFFFF" height="25">
				<font color="#000000" size="1">NYSE</font></td>
				<td style="border-bottom:1px solid #C0C0C0; border-left-width: medium; border-right-width: medium; border-top-width: medium; ; " width="53" align="center" bgcolor="#FFFFFF" height="25">
				<font size="1"><%= FormatNumber(Replace(contents6(1), chr(34), ""),2) %></font></td>
				<td style="border-bottom:1px solid #C0C0C0; border-left-width: medium; border-right-width: medium; border-top-width: medium; ; " width="53" align="center" bgcolor="#FFFFFF" height="25">
				<font size="1"><%= Replace(contents6(4), chr(34), "") %><% If Replace(contents6(4), chr(34), "") > 0 Then %>
					<img border="0" src="/webff/other/images/up.gif" width="10" height="14">
					<% Else %>
					<img border="0" src="/webff/other/images/down.gif" width="10" height="14">
					<% End If %>
</font>
</td>
			</tr>
			
	
					
					</tr><tr>
					<td colspan="3" height="35" width="163">
					<p align="center">
					<font size="1">Data as of <%= Replace(contents6(2), chr(34), "") %> at <%= Replace(contents6(3), chr(34), "") %><br />Minimum 20 minute delay</font></td></tr></table></td>
	</tr>
	
</table>

									</td>

								</tr>
								</table>
</body>

</html>

Open in new window

Comment
Watch Question

Fixer of Problems
CERTIFIED EXPERT
Most Valuable Expert 2014
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
wow, that really stinks. Thanks you.
Dave BaldwinFixer of Problems
CERTIFIED EXPERT
Most Valuable Expert 2014

Commented:
You know, I did answer your question.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.