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

        <bdo id='TyBll'></bdo><ul id='TyBll'></ul>

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

        Twitter OAuth (PHP):需要良好的基本示例才能开始

        时间:2023-09-24
      1. <tfoot id='QkNyg'></tfoot>

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

                <tbody id='QkNyg'></tbody>
              • <bdo id='QkNyg'></bdo><ul id='QkNyg'></ul>

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

                  本文介绍了Twitter OAuth (PHP):需要良好的基本示例才能开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  使用 Facebook 的 PHP SDK,我能够在我的网站上快速登录 Facebook.他们只需设置一个可以很容易访问的 $user 变量.

                  Using Facebook's PHP SDK, I was able to get Facebook login working pretty quickly on my website. They simply set a $user variable that can be accessed very easily.

                  我没有这么幸运地尝试让 Twitter 的 OAuth 登录工作......坦率地说,他们的 github 材料对于 PHP 和网页设计相对较新的人来说是令人困惑和无用的,更不用说许多非官方示例了我曾尝试解决同样令人困惑或过时的问题.

                  I've had no such luck trying to get Twitter's OAuth login working... quite frankly, their github material is confusing and useless for someone that's relatively new to PHP and web design, not to mention that many of the unofficial examples I've tried working through are just as confusing or are outdated.

                  我真的需要一些帮助才能让 Twitter 登录工作——我的意思只是一个基本的例子,我点击登录按钮,我授权我的应用程序,它重定向到一个页面,在那里显示登录用户的姓名.

                  I really need some help getting Twitter login working--I mean just a basic example where I click the login button, I authorize my app, and it redirects to a page where it displays the name of the logged in user.

                  非常感谢您的帮助.

                  编辑我知道存在 abraham 的 twitter oauth 但是它几乎没有提供任何让他的东西工作的说明.

                  EDIT I'm aware of the existence of abraham's twitter oauth but it provides close to no instructions whatsoever to get his stuff working.

                  推荐答案

                  我刚刚从 github 尝试了 abraham 的 twitteroauth,它似​​乎对我来说很好用.这就是我所做的

                  I just tried abraham's twitteroauth from github and it seems to work fine for me. This is what I did

                  1. git 克隆 https://github.com/abraham/twitteroauth.git
                  2. 将其上传到您的虚拟主机,例如 www.example.com
                  3. 转到Twitter 应用 并注册您的应用程序.您需要的更改是(假设您将使用托管在 http://www.example.com 上的 abraham 的 twitteroauth 示例/twitteroauth)
                    a) 申请网站将是 http://www.example.com/twitteroauth
                    b) 应用程序类型将是浏览器
                    c) 回调 url 是 http://www.example.com/twitteroauth/callback.php (Callback.php 包含在git源码中)
                  4. 完成此操作后,您将获得 CONSUMER_KEY 和 CONSUMER_SECRET,您可以在 twitteroauth 发行版的 config.php 中更新它们.还将回调设置为与 http://www.example.com/twitteroauth/callback 相同.php
                  1. git clone https://github.com/abraham/twitteroauth.git
                  2. Upload this into your webhost with domain, say, www.example.com
                  3. Go to Twitter Apps and register your application. The changes that you need are (assuming that you will use abraham's twitteroauth example hosted at http://www.example.com/twitteroauth)
                    a) Application Website will be http://www.example.com/twitteroauth
                    b) Application type will be browser
                    c) Callback url is http://www.example.com/twitteroauth/callback.php (Callback.php is included in the git source)
                  4. Once you do this, you will get the CONSUMER_KEY and CONSUMER_SECRET which you can update in the config.php from the twitteroauth distribution. Also set the callback to be the same as http://www.example.com/twitteroauth/callback.php

                  就是这样.如果您现在导航到 http://www.example.com/twitteroauth,您将获得使用 Twitter 登录",这会将您带到 Twitter,授权请求并让您返回 index.php 页面.

                  Thats it. If you now navigate to http://www.example.com/twitteroauth, you will get a "Signin with Twitter", that will take you to Twitter , authorize the request and get you back to the index.php page.

                  示例将不起作用,但不要担心.按照以上步骤上传到服务器.确保从 github 存储库重命名文件,即 config-sample.php->config.php

                  Example will not work but do not worry. Follow the above steps and upload to server. Make sure you rename the file from github repository i.e. config-sample.php->config.php

                  如果您想查看工作示例,请在此处

                  if you want to see a working sample, find it here

                  这篇关于Twitter OAuth (PHP):需要良好的基本示例才能开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:我们可以从 Twitter oauth API 获取电子邮件 ID 吗? 下一篇:如何使用正则表达式验证 Twitter 用户名

                  相关文章

                  最新文章

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

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

                    • <bdo id='ohrnz'></bdo><ul id='ohrnz'></ul>