<tfoot id='bRVsu'></tfoot>

    <bdo id='bRVsu'></bdo><ul id='bRVsu'></ul>
<i id='bRVsu'><tr id='bRVsu'><dt id='bRVsu'><q id='bRVsu'><span id='bRVsu'><b id='bRVsu'><form id='bRVsu'><ins id='bRVsu'></ins><ul id='bRVsu'></ul><sub id='bRVsu'></sub></form><legend id='bRVsu'></legend><bdo id='bRVsu'><pre id='bRVsu'><center id='bRVsu'></center></pre></bdo></b><th id='bRVsu'></th></span></q></dt></tr></i><div id='bRVsu'><tfoot id='bRVsu'></tfoot><dl id='bRVsu'><fieldset id='bRVsu'></fieldset></dl></div>
    <legend id='bRVsu'><style id='bRVsu'><dir id='bRVsu'><q id='bRVsu'></q></dir></style></legend>

      <small id='bRVsu'></small><noframes id='bRVsu'>

      如何将 OAuth 与 PHP 和 cURL 结合使用?

      How do I use OAuth with PHP and cURL?(如何将 OAuth 与 PHP 和 cURL 结合使用?)

            • <bdo id='809yw'></bdo><ul id='809yw'></ul>
                <tbody id='809yw'></tbody>

                <small id='809yw'></small><noframes id='809yw'>

                <tfoot id='809yw'></tfoot>
              1. <legend id='809yw'><style id='809yw'><dir id='809yw'><q id='809yw'></q></dir></style></legend>
              2. <i id='809yw'><tr id='809yw'><dt id='809yw'><q id='809yw'><span id='809yw'><b id='809yw'><form id='809yw'><ins id='809yw'></ins><ul id='809yw'></ul><sub id='809yw'></sub></form><legend id='809yw'></legend><bdo id='809yw'><pre id='809yw'><center id='809yw'></center></pre></bdo></b><th id='809yw'></th></span></q></dt></tr></i><div id='809yw'><tfoot id='809yw'></tfoot><dl id='809yw'><fieldset id='809yw'></fieldset></dl></div>

                本文介绍了如何将 OAuth 与 PHP 和 cURL 结合使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在尝试通过他们的数据 API 向 YouTube 进行身份验证,并且只需要知道如何将标题从他们的示例(如下)转换为 PHP+CURL 函数调用.令人困惑的部分是授权部分,它用自己的一组名称和值对破坏了名称/值配对.

                I'm trying to authenticate to YouTube via their Data API and simply need to know how the headers should be translated from their example (below) to PHP+CURL function calls. The confusing part being the Authorization portion, which breaks name/value pairing with its own set of name and value pairs.

                本文档都很好,只是我不知道不知道如何格式化他们在标题中需要的内容.

                This documentation is all well and good except I don't know how to format what they require in the headers.

                他们的例子:

                POST /accounts/OAuthGetRequestToken HTTP/1.1
                Host: https://www.google.com
                Content-Type: application/x-www-form-urlencoded
                Authorization: OAuth
                               oauth_consumer_key="example.com",
                               oauth_signature_method="RSA-SHA1",
                               oauth_signature="wOJIO9A2W5mFwDgiDvZbTSMK%2FPY%3D",
                               oauth_timestamp="137131200",
                               oauth_nonce="4572616e48616d6d65724c61686176",
                               oauth_version="1.0"
                scope=http://gdata.youtube.com
                

                这不需要花哨,我只需要为一个帐户进行密钥交换,这样我就可以自动上传视频.我只是不知道如何将授权项格式化为我的标题数组

                This doesn't need to be fancy, I just need to do the key exchange for one account so I can upload videos automatically. I just don't know how to format the Authorization items into a headers array for my

                curl_setopt($ch, CURLOPT_HEADER, $headers);
                

                帮助?

                推荐答案

                我之前没有使用过 youtube api,但我已经使用 OAuth 为 Web 应用程序制作了自己的 REST api.

                i didn't used the youtube api before but i have made my own REST api using OAuth for a web app.

                标题应该是:application/x-www-form-urlencoded就像例子所说的,oauth_consumer_key、oauth_signature_method、oauth_signature等参数需要使用post发送,所以你需要这样写:

                the header should be: application/x-www-form-urlencoded and as the example say, the parameters as oauth_consumer_key, oauth_signature_method,oauth_signature etc.. need to be sent using post, so you need to put it like this:

                        $header[]         = 'Content-Type: application/x-www-form-urlencoded';
                
                            curl_setopt($ch, CURLOPT_HTTPHEADER,     $header);
                            curl_setopt($ch, CURLOPT_POST,        true);
                            curl_setopt($ch, CURLOPT_POSTFIELDS, urlencode("oauth_consumer_key=example.com&
                           oauth_signature_method=RSA-SHA1&
                           oauth_signature=wOJIO9A2W5mFwDgiDvZbTSMK%2FPY%3D&
                           oauth_timestamp=137131200&
                           oauth_nonce=4572616e48616d6d65724c61686176&
                           oauth_version=1.0"));
                

                我希望它有帮助:D

                问候.

                这篇关于如何将 OAuth 与 PHP 和 cURL 结合使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
              3. <legend id='tnTRj'><style id='tnTRj'><dir id='tnTRj'><q id='tnTRj'></q></dir></style></legend>

                <small id='tnTRj'></small><noframes id='tnTRj'>

                  1. <tfoot id='tnTRj'></tfoot>
                    <i id='tnTRj'><tr id='tnTRj'><dt id='tnTRj'><q id='tnTRj'><span id='tnTRj'><b id='tnTRj'><form id='tnTRj'><ins id='tnTRj'></ins><ul id='tnTRj'></ul><sub id='tnTRj'></sub></form><legend id='tnTRj'></legend><bdo id='tnTRj'><pre id='tnTRj'><center id='tnTRj'></center></pre></bdo></b><th id='tnTRj'></th></span></q></dt></tr></i><div id='tnTRj'><tfoot id='tnTRj'></tfoot><dl id='tnTRj'><fieldset id='tnTRj'></fieldset></dl></div>
                      <tbody id='tnTRj'></tbody>
                    • <bdo id='tnTRj'></bdo><ul id='tnTRj'></ul>