ursvmg Posted August 11, 2010 Share Posted August 11, 2010 Hi everyone, I'm trying to build a web application in PHP that takes scanned images from user and convert it in to text document. I would like to use Google's Documents List Data API inside my PHP scripts. The online application is available at http://googlecodesamples.com/docs/php/ocr.php. I do not know where to start with and how to invoke the API. Could anyone please direct me.. ? If anyone has any samples, kindly provide. Link to comment https://forums.phpfreaks.com/topic/210485-google-data-api-in-php/ Share on other sites More sharing options...
ursvmg Posted August 13, 2010 Author Share Posted August 13, 2010 Hello.. Anyone please? Link to comment https://forums.phpfreaks.com/topic/210485-google-data-api-in-php/#findComment-1098874 Share on other sites More sharing options...
binhngoc17 Posted August 18, 2010 Share Posted August 18, 2010 Actually, I am also working on google API. I try to retrieve documents from my google docs. I found the Zend framework for G_data. It contain the API to access google docs. However, i am stucking with using the error message: `invalid token`. It makes me suspect that the API can only be used for Google Apps Premium edition. There are ways that you don't need o use the API. You just hard-core coding, this link show that: http://code.google.com/apis/spreadsheets/data/3.0/developers_guide_protocol.html#ListingSpreadsheets . However, I hvnt tried it yet coz I am not very good at sending POST and GET HTTP Request. If you know any way to work about it, please enlighten me. Link to comment https://forums.phpfreaks.com/topic/210485-google-data-api-in-php/#findComment-1100725 Share on other sites More sharing options...
binhngoc17 Posted August 18, 2010 Share Posted August 18, 2010 <?php foreach (glob("../libraries/Zend/Gdata/*.php") as $filename) { require_once($filename); } $email = 'username@domain'; $passwd = 'pass'; try { $httpClient = Zend_Gdata_ClientLogin::getHttpClient($email, $passwd, 'cl'); } catch (Zend_Gdata_App_CaptchaRequiredException $cre) { echo 'URL of CAPTCHA image: ' . $cre->getCaptchaUrl() . "\n"; echo 'Token ID: ' . $cre->getCaptchaToken() . "\n"; } catch (Zend_Gdata_App_AuthException $ae) { echo 'Problem authenticating: ' . $ae->exception() . "\n"; } try{ $gdClient = new Zend_Gdata_Spreadsheets($httpClient); print "== Available Spreadsheets ==\n"; //the error is from this line $feed = $gdClient->getSpreadsheetFeed(); } catch(Zend_Gdata_App_HttpException $exception) { echo "Error: " . $exception->getResponse()->getRawBody(); } ?> Link to comment https://forums.phpfreaks.com/topic/210485-google-data-api-in-php/#findComment-1100741 Share on other sites More sharing options...
binhngoc17 Posted August 18, 2010 Share Posted August 18, 2010 It is solved, the correct code is: <?php foreach (glob("../libraries/Zend/Gdata/*.php") as $filename) { require_once($filename); } $email = 'username@domain'; $passwd = 'pass'; try { $httpClient = Zend_Gdata_ClientLogin::getHttpClient($email, $passwd, Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME); } catch (Zend_Gdata_App_CaptchaRequiredException $cre) { echo 'URL of CAPTCHA image: ' . $cre->getCaptchaUrl() . "\n"; echo 'Token ID: ' . $cre->getCaptchaToken() . "\n"; } catch (Zend_Gdata_App_AuthException $ae) { echo 'Problem authenticating: ' . $ae->exception() . "\n"; } try{ $gdClient = new Zend_Gdata_Spreadsheets($httpClient); print "== Available Spreadsheets ==\n"; //the error is from this line $feed = $gdClient->getSpreadsheetFeed(); } catch(Zend_Gdata_App_HttpException $exception) { echo "Error: " . $exception->getResponse()->getRawBody(); } ?> Those are links for reference of google docs API: http://code.google.com/apis/documents/docs/1.0/developers_guide_php.html http://framework.zend.com/manual/en/zend.gdata.spreadsheets.html http://code.google.com/apis/spreadsheets/data/1.0/developers_guide_php.html Link to comment https://forums.phpfreaks.com/topic/210485-google-data-api-in-php/#findComment-1100748 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.