Can a Google Document get programmatically created from HTML form data? - php

I've written a simple web app that creates a MS Word document from an HTML form (using JavaScript and PHP also) but I've since converted to Google Docs.
After spending most of the day trying to see if switching from .docx's to .gdoc's was doable (perhaps with a different PHP plugin), I can't seem to find a way to programmatically create a Google Doc without using Google Scripts or a server running Google App Engine.
My question: Can a Google Document get programmatically created using PHP and an HTML form?

You can check the Google Drive SDK documentation for everything related to Google Docs: https://developers.google.com/drive/web/about-sdk
An easy way to push files in would be to upload them: https://developers.google.com/drive/web/manage-uploads#simple

Related

Google Drive API - PHP (CRUD)

I tried to make script that editing google spreadsheets. But documentation it's not enough to understand how exactly work API. I made registration in API Manager and I downloaded the json file. Could you give me some examples how I can edit document in google drive? Thanks
You can use Google Realtime API, it provides collaboration as a service for files in Google Drive via the use of operational transforms. The API is a JavaScript library hosted by Google that provides collaborative objects, events, and methods for creating collaborative applications.
Realtime API data model may change as a result of edits that were made by someone other than the current user. Realtime data models are "eventually consistent." That means that if all collaborators stop editing, eventually everyone will see the same data model.
Applications where multiple people need to edit the same data simultaneously. Document editors are excellent examples of this kind of application. The Realtime API handles all aspects of data transmission, storage, and conflict resolution when multiple users are editing a file.
For scripting, use Class DocumentApp, the document service creates and opens Documents that can be edited. Documents may be opened or created using DocumentApp.
// Open a document by ID.
var doc = DocumentApp.openById('DOCUMENT_ID_GOES_HERE');
// Create and open a document.
doc = DocumentApp.create('Document Name');
Here's a documentation how to update drive files: https://developers.google.com/drive/v2/reference/files/update

Parse: upload PHP files

I am new to using Parse and am developing an app using it as a backend. I want to also use it to develop a portal that would access data submitted from the mobile app.
Can I use Parse Cloud Code to upload my PHP files there (developed using PHP SDK)? Or should I upload it to another hosting provider and connect to Parse?
In the docs, it states I can use javascript library there but didn't catch anything about PHP SDK files uploaded and accessed from there.
Thanks,
No you can't, Cloud Code only supports JavaScript. If you want to use PHP for server-side logic (beforeSave triggers for example), look into using Webhooks which will hit an endpoint on a server specified by you (see https://www.parse.com/docs/js/guide#cloud-code-advanced-cloud-code-webhooks)
If you are looking into hosting some sort of frontend on Parse (for example an admin area) then your only option is JavaScript, see https://www.parse.com/docs/js/guide#hosting

Creating an Android app using PHP

I'm going to create an Android app for the first time, and I wanted to do it in PHP, I've done some research and found the likes of PhoneGap, but I'm still quite short in the area, could someone give me a start?
What I'm going to be doing is a simple app for testing, a shop where you search for products, add them to your cart and check out, and the names of the products you ordered will be entered to a database.
Basically;
Search for products->add to cart->check out->info sent to database (all through PHP).
Where should I start?
Cordova is mainly a JavaScript framework that exposes native device features as JavaScript functions. Think of a cordova application like a plain HTML & Javascript website running in a Webview within your mobile application. The PHP interpreter isn't available on a mobile device, which is why you cannot package PHP files into a cordova app and expect it to work.
You could however write your backend in PHP and use XMLHTTP calls (in JavaScript) to retrieve data and present it to the user.
Additionally you can use any JavaScript framework in combination with Cordova so if you are familiar with any of them (like jQuery, Knockout or Angular) that would be an advantage. I'd suggest starting with a Cordova tutorial, like for example this one: https://ccoenraets.github.io/cordova-tutorial/index.html
Another project that is getting alot of attention lately is the Ionic project, which is also based on Cordova. I'd think based on your requirements this would be a great framework to use: http://ionicframework.com/

How to connect PHP GAE(Google App Engine) to Google Docs, Spreadsheets

I have a PHP app deployed in GAE(Google App Engine)
I need to connect to Google Docs, Google Spreadsheet URL below and do all editions/manage(edit a Doc, Edit a Sheet,...etc) as like I am able to do via GAS, just like we manage the CAL API.
https://developers.google.com/apps-script/reference/document/
https://developers.google.com/apps-script/reference/spreadsheet/
What is the best approach for it? How to use those functions available in GAS via PHP GAE?
Plz someone help, a small tip would also help us.
In PHP, you can make an HTTP Request. In Apps Script, you can create a Stand Alone Apps Script project, that detects either a GET or POST request, and runs code. Then the code can do whatever you want it to do (E.g. write data to spreadsheet). When the code is done, you can have it return something back to the PHP code that called it.
So, you can use an Apps Script project as an intermediary between your PHP and a Google spreadsheet. This avoids needing to use the PHP API for Google Spreadsheets. The Apps Script file is an intermediary between your PHP code and getting data written/read from your spreadsheet. But an API is also an intermediary. So, in that sense it's the same. If you already have Apps Script code that does what you want, you can trigger it to run with a doGet() or doPost() function. And you can avoid learning the API.
For more information see the following post:
stackoverflow answer - Call a custom GAS function from external URL

Is it possible to edit Google Drive's spreadsheet using some HTTP API?

Is it really possible to directly edit content of a spreadsheet that is located on some Google Drive account from, lets say PHP application?
Is there an API available with granular operations or do I need to download/edit/upload the whole document every time?
Is it also possible to call my script via HTTP when changes are made to this document by user?
Is there any examples of such functionality in PHP or similar technology?

Categories