[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: More Google DOC's guessing-games



A redirect is a redirect. There is an example of how to handle redirects in EXAMPLE4 and in EXAMPLE9 (slightly different ways to do it).

The VBA code you are copying says set the content header to "application...bla...blah". This is something added to the header - not sent as part of the data. You can see in EXAMPLE4 how to send the CONTENT TYPE on the http_url_post. You just pass it as the seventh parameter. The name Content-Type is added to the header with the value "application...."  

I am not a protocol expert but I think your post data needs to be encoded. The content-type you are trying to send says ....urlencoded. Scott wrote the WEBFORM_postData stuff to make it easy to do. Since you are not sending a name with the value on the Entry stuff I am not sure how you can do that within the postData but there is an example somewhere of using the encoding to grab a string.

I don't know anything about how Google views directly modifying Docs without authorization but I would be surprised that this would work for very long before you will be forced to do OAUTH or some other authorization scheme. While it can look daunting (I have looked and it LOOKS daunting), OAUTH is probably the way to go. Anyone with a working scheme want to share what they have so far?

Interesting thing about the redirect URI ... I ended up at RRD login screen. Have you successfully run any of the HTTPAPI EXAMPLE programs?

________________________________________
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of David Hanneman [dave.c.hanneman@xxxxxxx]
Sent: Thursday, August 16, 2012 7:02 PM
To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Subject: More Google DOC's guessing-games

Hi all,

I am still working on sending a row insert to a Google spreadsheet. I am
getting closer - at least now the server is answering with a 302 redirect.
I am looking for a more knowledgeable HTTPAPI guru make some suggestions on
getting this working. I am not sure what to do with the 302 response. I
suspect it could be Google no allowing access to the GOOGLE FORM in this
way. Debug log is attached.

Using some input from a poster on stackoverflow.com (below) on using a
FORMRESPONSE method to send to Google without a Client Login or OAuth2
token.

How to write to a Google Spreadsheet from Excel 2003
VBA<http://stackoverflow.com/questions/9737354/how-to-write-to-a-google-spreadsheet-from-excel-2003-vba/9870311#9870311>

I setup a version of EXAMPLE4 to simulate sending a FORM to Google outside
of using the callp to WEBFORM.

Here is my code sippet:

D data            S           1024A
D QQ              C                   CONST(x'7F')
D POST_TO         S           1024A   INZ('https://docs.google.com/a/rrd.c+
D
 om/spreadsheet/formResponse?formkey=+
D
 dGRwaG43Y2xiOWRmazFYeUdqX3BRZmc6M&i+
D                                          fq&ctok=9091786339820450096')
D RequestHeader   C        CONST('"Content-Type","applicatio
D
 -www-form-urlencoded')

 /free
    data = RequestHeader +
    QQ +'entry.0.single=' + QQ + 'column1'  +
    QQ +'entry.1.single=' + QQ + 'column2'  +
    QQ +'entry.2.single=' + QQ + 'column3'  +
    QQ +'entry.3.single=' + QQ + 'column4'  +
    QQ +'entry.4.single=' + QQ + 'column5'  +
    QQ +'entry.5.single=' + QQ + 'column6'  +
    QQ +'entry.6.single=' + QQ + 'column7'  +
    QQ +'entry.7.single=' + QQ + 'column8'  +
    QQ +'entry.8.single=' + QQ + 'column9'  +
    QQ +'entry.9.single=' + QQ + 'column10' +
    QQ +'&pageNumber=0&backupCache&submit=Submit'+QQ;

    rc=http_url_post(POST_TO
                     :%addr(data)
                     :%len(%trimr(data))
                     :'/tmp/httptest.html');

      if        rc <> 200;
        msg = http_error;
        dsply msg;
        return;

----------------------- VALUES IN DEBUG -------------------

My POST_TO looks like this:

https://docs.google.com/a/rrd.com/spreadsheet/formResponse?f
ormkey=dGRwaG43Y2xiOWRmazFYeUdqX3BRZmc6MQ&ifq&ctok=909178633
9820450096

and DATA :

"Content-Type","application/x-www-form-urlencoded"entry.0.si
ngle="column1"entry.1.single="column2"entry.2.single="column
3"entry.3.single="column4"entry.4.single="column5"entry.5.si
ngle="column6"entry.6.single="column7"entry.7.single="column
8"entry.8.single="column9"entry.9.single="column10"&pageNumb
er=0&backupCache&submit=Submit"

---------------------------------------------------------------------------



*Dave Hanneman | Technical Analyst III, Warehouse Business Systems | RR
Donnelley*
3075 Highland Avenue | Downers Grove, IL 60515
Office: 630.322.6420
dave.c.hanneman@xxxxxxx
http://www.rrdonnelley.com
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------