madisoniv.com
New Member
- Messages
- 5
- Reaction score
- 0
- Points
- 0
So I tried creating a PHP page that uses the Google API to access your Google Spreadsheets. However, I'm having some trouble getting it to work on x10Hosting. I tried it on my friend's server, and it works fine, however, I get an error when I try running it on here. My code, error, and expected output are below. If anyone has any ideas, please let me know. Thanks.
CODE:
<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Http_Client');
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Spreadsheets');
$authService = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
$httpClient = Zend_Gdata_ClientLogin::getHttpClient("******", "******", $authService);
$gdClient = new Zend_Gdata_Spreadsheets($httpClient);
$feed = $gdClient->getSpreadsheetFeed();
echo "== Available Spreadsheets ==<br>";
printFeed($feed);
$input = 0;
$currKey = split('/', $feed->entries[$input]->id->text);
$currKey = $currKey[5];
function printFeed($feed)
{
$i = 0;
foreach($feed->entries as $entry) {
if ($entry instanceof Zend_Gdata_Spreadsheets_CellEntry) {
echo $entry->title->text .' '. $entry->content->text . "<br>";
} else if ($entry instanceof Zend_Gdata_Spreadsheets_ListEntry) {
echo $i .' '. $entry->title->text .' | '. $entry->content->text . "<br>";
} else {
echo $i .' '. $entry->title->text . "<br>";
}
$i++;
}
}
ERROR:
Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Unable to Connect to ssl://www.google.com:443. Error #: ' in /home/ivcf/public_html/Zend/Gdata/ClientLogin.php:141 Stack trace: #0 /home/ivcf/public_html/google.php(9): Zend_Gdata_ClientLogin::getHttpClient('madisoniv.com', 'Urb4na09', 'wise') #1 {main} thrown in /home/ivcf/public_html/Zend/Gdata/ClientLogin.php on line 141
EXPECTED OUTPUT: (what I get when I run it on my friend's server)
== Available Spreadsheets ==
0 Website
Edit:
Does this have something to do with not having ports open? I did a little looking around and it sounds like free hosts don't generally open up ports. If that's the case, is there any way to request a port be opened so a connection could be made from my site to Google?
CODE:
<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Http_Client');
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Spreadsheets');
$authService = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
$httpClient = Zend_Gdata_ClientLogin::getHttpClient("******", "******", $authService);
$gdClient = new Zend_Gdata_Spreadsheets($httpClient);
$feed = $gdClient->getSpreadsheetFeed();
echo "== Available Spreadsheets ==<br>";
printFeed($feed);
$input = 0;
$currKey = split('/', $feed->entries[$input]->id->text);
$currKey = $currKey[5];
function printFeed($feed)
{
$i = 0;
foreach($feed->entries as $entry) {
if ($entry instanceof Zend_Gdata_Spreadsheets_CellEntry) {
echo $entry->title->text .' '. $entry->content->text . "<br>";
} else if ($entry instanceof Zend_Gdata_Spreadsheets_ListEntry) {
echo $i .' '. $entry->title->text .' | '. $entry->content->text . "<br>";
} else {
echo $i .' '. $entry->title->text . "<br>";
}
$i++;
}
}
ERROR:
Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Unable to Connect to ssl://www.google.com:443. Error #: ' in /home/ivcf/public_html/Zend/Gdata/ClientLogin.php:141 Stack trace: #0 /home/ivcf/public_html/google.php(9): Zend_Gdata_ClientLogin::getHttpClient('madisoniv.com', 'Urb4na09', 'wise') #1 {main} thrown in /home/ivcf/public_html/Zend/Gdata/ClientLogin.php on line 141
EXPECTED OUTPUT: (what I get when I run it on my friend's server)
== Available Spreadsheets ==
0 Website
Edit:
Does this have something to do with not having ports open? I did a little looking around and it sounds like free hosts don't generally open up ports. If that's the case, is there any way to request a port be opened so a connection could be made from my site to Google?
Last edited: