In the next 5 minutes, you could get $5 worth of plumbing services, $30 worth of legal advice or $17 worth of psychotherapy. Or, you could just spend your next five minutes building a real-time stock quote widget. Don't think it can be done in 5 minutes? Check out a video showing us doing it in less time.
Here's how you can do the same thing using PHP and Eclipse,
although the same basic process can be used for any language and
Step 1: Subscribe to XigniteRealTime to get access to real-time, Level I stock quotes. If you're not ready to subscribe yet, you can also sign up for a free trial and get access to other real-time stock quote web services such as XigniteNASDAQLastSale and XigniteBATSLastSale. You'll need to make a few adjustments to the sample code below to point to a different web service, but nothing major.
Step 2: Start a new PHP project in Eclipse.
Step 3: Create your index.php page with the following code:
<html><title>Get Real-Time Quote</title><body><form>
<input type="text" name="symbol" />
<input type="submit" value="Go" />
$client = new SoapClient('http://www.xignite.com/xRealTime.asmx?WSDL');
$quote = $client->GetRealQuote(array('Exchange' => "INET", 'Symbol' => $_GET["Symbol"], 'IncludeBidAsk' => "false"));
echo "Last price: ", $quote->GetRealQuoteResult->Last;
Step 4: Open a browser and load your index.php page to give your new stock quote widget a spin.
Congratulations! You just built a real-time stock quote widget in PHP and made a plumber, a lawyer and a psychotherapist very disappointed in you for such a ridiculous waste of your time.