来自Google Docs API的数据供稿

I am trying to use the Google Docs API to get spreadsheet data as XML, and eventually JSON data. I have put the URL (http://spreadsheets.google.com/feeds/list/0Aizy-VIdLC0QdDNNRkpfVncxQzZRNG9fMVhueXVMenc/1/private/values) in my browser, and I get the data, even when not logged in to Google.

When I try with jQuery Ajax, I get the "page not found" error.

$.get('http://spreadsheets.google.com/feeds/list/0Aizy-VIdLC0QdDNNRkpfVncxQzZRNG9fMVhueXVMenc/1/private/values', function(data) {
  console.log(data)
});

I am guessing that same origin policy might be the cause of the Ajax error, so I tried with PHP, but I get the error.

echo file_get_contents("http://spreadsheets.google.com/feeds/list/0Aizy-VIdLC0QdDNNRkpfVncxQzZRNG9fMVhueXVMenc/1/private/values");

I am aiming to get the Google Docs spreadsheet data into a JSON object for use on a webpage.

How can I fix this error?

查看全部
weixin_33695450
weixin_33695450
2011/09/09 19:08
  • xml
  • ajax
  • javascript
  • 点赞
  • 收藏
  • 回答
    私信

2个回复