0

Hey guys,

Little problem. I have the feed URL for a Google Docs spreadsheet. I use CURL to perform the request and get the data from the feed, but the only problem is is that I cannot echo that data out to the browser. Here is my code:

<?php
//Set up the data needed to access the sheet
$spreadsheetKey="***************************************";
$spreadsheetUrl = "http://spreadsheets.google.com/feeds/cells/$spreadsheetKey/1/public/values";

//CURL optons and setup
$getSheet = curl_init();
curl_setopt($getSheet, CURLOPT_URL, $spreadsheetUrl);
curl_setopt($getSheet, CURLOPT_HEADER, 0);
curl_setopt($getSheet, CURLOPT_RETURNTRANSFER, TRUE);

//Run the command and clean up
$sheetContents = curl_exec($getSheet);
curl_close($getSheet);

if($sheetContents)
{
	echo "Got the data:<br/>";
	print_r($sheet_contents);
}
else
{
	echo "No data returned, curl returned FALSE";
}
?>

The page is echoing out "Got the data:", but nothing is after that. So there /is/ something in the $sheet_contents variable, but PHP cannot parse it to the browser?
I can access the feed in a web browser. It is displayed as an XML feed, as it should.
Thanks for your help.
--Dylan

1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by dylank
0

Never mind, had to put it into a simplexml object.

I still dont understand why I cant just echo out the feed, tho?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.