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

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.