English 中文(简体)
Is there easy way to retrieve Google Finance data?
原标题:

Once in a day we want to download google finance data for 6100+ stock symbols. Right now we are going to this url and getting the data for all stock symbols. http://www.google.com/finance?q=NYSE:AA&fstype=ii

Getting the data like this use lots of bandwidth and slowness on the server.

Is there better way to get the data from Google.

There is Google Finance API, but it is not available in PHP

问题回答

The Google Finance API is available for use by all web scripting languages. All the API is is a description of and instructions on how to utilize their REST service. You use something like cURL in PHP to call to their REST service and retrieve the results output by it in XML format, and then parse the XML to display, store, whatever the information retreived.

Note that even though they don t have an example for PHP like they do for many of their APIs, their APIs still all use the same sort of system, so the examples provided for something like the Google Spreadsheets Data API or the Google Documents List API would be valid for getting a starting point on the Google Finance API. The difference between them would be the parameters passed, the data returned, and the url which you would be calling with the parameters to get the data.

If you can live without the data coming from Google, have you looked at the Yahoo Finance API? It s pretty flexible and allows the downloading of multiple symbols at once (though you may not necessarily want to do all 6100 at once).

For example, you can do:

http://finance.yahoo.com/d/quotes.csv?s=XOM+BBDb.TO+JNJ+MSFT&f=snd1l1yr

More detail on how to use the API is nicely written up at:

http://www.gummy-stuff.org/Yahoo-data.htm





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签