Jump to content

Recommended Posts

Here is the code I was left to work with since the guy who wrote it is away, anyway i am not that good with PHP so any help would be greatly appreciated.

it keeps telling me the tickersymbol is not registered. now this could be because of Yahoo finance, and I beleive the URl may be wrong Im not sure.

you can go here to see the error. http://www.oncologymed.com/investor_relations.php

-------------------------------------------------------------

  <!-- Begin stock ticker code -->

<?

//enter the stock symbol here

$tickersymbol = "ONCO.PK";

 

if (isset($tickersymbol))

{

 

$open = fopen("http://quote.yahoo.com/d/quotes.csv?s=$tickersymbol&f=sl1d1t1c1ohgv&e=.csv", "r");

$read = fread($open, 2000);

fclose($open);

 

$read = str_replace("\"", "", $read);

$read = explode(",", $read);

 

IF ($read[1] == 0)

{

echo ("The symbol (<b>\"$tickersymbol\"</b>) doesn't appear to be registered<BR></FONT><BR>");

}

 

ELSE

{

 

?>

<div align="center">

<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=1 WIDTH=166>

<TR bgcolor="#FFE3C1">

<TD width=45 align="left"><font color="#CC9966" face="Arial, Helvetica, sans-serif" size="2"><strong><? echo ("$read[0]"); ?></strong></font></TD>

<TD width=94 align="right" valign="middle"><font color="#CC9966" face="Arial, Helvetica, sans-serif" size="2"><strong><? echo ("$read[3]"); ?></strong></font></TD>

</TR>

<TR valign="middle">

<TD align="left"><font color="666600" size="1" face="Arial, Helvetica, sans-serif">Current:</font></TD>

<TD align="right" valign="middle"><font color="666600" size="1" face="Arial, Helvetica, sans-serif"><? echo ("$read[1]"); ?></font></TD>

</TR>

<tr>

<td colspan="2"><hr size="1" noshade></td>

</tr>

<TR valign="middle">

<TD align="left"><font color="666600" size="1" face="Arial, Helvetica, sans-serif">Change:</font></TD>

<TD align="right" valign="middle"><font color="666600" size="1" face="Arial, Helvetica, sans-serif"><? echo ("$read[4]"); ?></font></TD>

</TR>

<tr>

<td colspan="2"><hr size="1" noshade></td>

</tr>

<TR valign="middle">

<TD align="left"><font color="666600" size="1" face="Arial, Helvetica, sans-serif">Opened At:</font></TD>

<TD align="right" valign="middle"><font color="666600" size="1" face="Arial, Helvetica, sans-serif"><? echo ("$read[5]"); ?></font></TD>

</TR>

<tr>

<td colspan="2"><hr size="1" noshade></td>

</tr>

<TR valign="middle">

<TD align="left"><font color="666600" size="1" face="Arial, Helvetica, sans-serif">Day Range:</font></TD>

<TD align="right" valign="middle"><font color="666600" size="1" face="Arial, Helvetica, sans-serif"><? echo ("$read[6] - $read[7]"); ?></font></TD>

</TR>

<tr>

<td colspan="2"><hr size="1" noshade></td>

</tr>

<TR valign="middle">

<TD align="left"><font color="666600" size="1" face="Arial, Helvetica, sans-serif">Volume:</font></TD>

<TD align="right" valign="middle"><font color="666600" size="1" face="Arial, Helvetica, sans-serif"><? echo ("$read[8]"); ?></font></TD>

<tr>

<td colspan="2" height="1" bgcolor="#FFE3C1"> </td>

</tr>

</TABLE>

</div>

 

<?

}

}

?>

<!-- End stock ticker code -->

Link to comment
https://forums.phpfreaks.com/topic/68710-solved-error-with-stock-ticker-code/
Share on other sites

Well, a quick check of the source code tells me none of your PHP is being executed. This could be for a number of reasons.

 

Hopefully it is just a case of the short_open_tags directive being set to off. Try using full opening tags (<?php) instead of short ones (<?).

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.