使用 PHP API 获取 Google Docs 公共链接

发布于 2024-12-17 02:21:14 字数 2049 浏览 6 评论 0原文

我有一个使用 Google 文档 API 将文件上传到 Google 文档的代码。该文件已上传到公共收藏,但是如何才能发布公共链接?

完成上传后,我得到:

SimpleXMLElement Object
(
    [id] => https://docs.google.com/feeds/id/file%3A0B6yYgWS-CUJ2MDczZTRlY2YtZTRiMi00MWQ2LTliYjMtMDZiYWY0YjdjNjYw
    [published] => 2011-11-21T18:39:10.316Z
    [updated] => 2011-11-21T18:39:10.316Z
    [category] => SimpleXMLElement Object
        (
            [@attributes] => Array
                (
                    [scheme] => http://schemas.google.com/g/2005#kind
                    [term] => http://schemas.google.com/docs/2007#file
                    [label] => application/zip
                )

        )

    [title] => 4eca9acc2c339-4ec3b7436bed4-test2docx.zip
    [content] => SimpleXMLElement Object
        (
            [@attributes] => Array
                (
                    [type] => application/zip
                    [src] => https://doc-14-88-docs.googleusercontent.com/docs/securesc/fcicpk40ckisatj1kultkrrcsbo6sba3/bnpt7i1b36sn91mta24etn98ou9ce2j0/1321900200000/11381682958832082931/11381682958832082931/0B6yYgWS-CUJ2MDczZTRlY2YtZTRiMi00MWQ2LTliYjMtMDZiYWY0YjdjNjYw?h=15825656760133770628&e=download&gd=true
                )

        )

    [link] => Array
        (
            [0] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [rel] => alternate
                            [type] => text/html
                            [href] => https://docs.google.com/a/agaco.es/leaf?id=0B6yYgWS-CUJ2MDczZTRlY2YtZTRiMi00MWQ2LTliYjMtMDZiYWY0YjdjNjYw&hl=en_US
                        )

                )
        )
)

但是这些链接中的任何一个都是要在我的网站上发布的公共链接。

从 API v3 如何获得类似 https://docs.google.com/open?id=0B6yYgWS-CUJ2ZTUxZGI4MGUtMWM0Yy00YzY0LWIxOTMtMDFlN2RjNDAxNGM2

问候, 利托。

I have a code to upload files to Google Docs using the Google Docs API. This files are uploaded to a public Collection, but, how can I get the public link to be published?

After the complete upload I get:

SimpleXMLElement Object
(
    [id] => https://docs.google.com/feeds/id/file%3A0B6yYgWS-CUJ2MDczZTRlY2YtZTRiMi00MWQ2LTliYjMtMDZiYWY0YjdjNjYw
    [published] => 2011-11-21T18:39:10.316Z
    [updated] => 2011-11-21T18:39:10.316Z
    [category] => SimpleXMLElement Object
        (
            [@attributes] => Array
                (
                    [scheme] => http://schemas.google.com/g/2005#kind
                    [term] => http://schemas.google.com/docs/2007#file
                    [label] => application/zip
                )

        )

    [title] => 4eca9acc2c339-4ec3b7436bed4-test2docx.zip
    [content] => SimpleXMLElement Object
        (
            [@attributes] => Array
                (
                    [type] => application/zip
                    [src] => https://doc-14-88-docs.googleusercontent.com/docs/securesc/fcicpk40ckisatj1kultkrrcsbo6sba3/bnpt7i1b36sn91mta24etn98ou9ce2j0/1321900200000/11381682958832082931/11381682958832082931/0B6yYgWS-CUJ2MDczZTRlY2YtZTRiMi00MWQ2LTliYjMtMDZiYWY0YjdjNjYw?h=15825656760133770628&e=download&gd=true
                )

        )

    [link] => Array
        (
            [0] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [rel] => alternate
                            [type] => text/html
                            [href] => https://docs.google.com/a/agaco.es/leaf?id=0B6yYgWS-CUJ2MDczZTRlY2YtZTRiMi00MWQ2LTliYjMtMDZiYWY0YjdjNjYw&hl=en_US
                        )

                )
        )
)

But any of this links are a public link to publish in my web.

From API v3 how can I get a link like https://docs.google.com/open?id=0B6yYgWS-CUJ2ZTUxZGI4MGUtMWM0Yy00YzY0LWIxOTMtMDFlN2RjNDAxNGM2

Regards,
Lito.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文