Login with Sina Weibo account (third party login), how to deal with it

Source: Internet
Author: User
Tags php language
Login with Sina Weibo account (third party login)
I downloaded the Sina SDK package, when I test, enter my Weibo account and password, click the Authorize Connection button, appear sorry, that page doesn ' t exist! this page, how should everyone solve? Thank you......


------Solution--------------------
Using API to synchronize with Sina Weibo under PHP

This afternoon to get a Sina Weibo synchronization application, test many times, finally succeeded, the following is my configuration process. Welcome everyone to my Sina Weibo guest!

First of all, you have to have Sina Weibo account number, do not register a, and then do a developer, can from the micro-blog point past, you can also directly enter the URL:/http open.t.sina.com.cn, select I am a developer, in the choice to create an application, go to fill in the developer information, after successful access to your app KEY and app SECRET, copy them down and save it.

Then, to download the SDK documentation, select the PHP language, see "Through the OAuth authentication method", I use this, click the link below download down, unzip to the local.

The third step is to start the test. The extracted files in the Weobodemo folder copy to the test directory, that is, your site directory, in advance to configure the virtual domain name, will not be able to refer to my other article, with Apache configuration independent virtual domain name.

Weibodemo This folder has a configuration file config.php, what to do after opening, you will know, put your app KEY and app SECRET write in. Open this level of directory in the browser, automatically run the index.php file, it is not verbose.

Here you will find that something went wrong: notice:undefined Index:script_uri in D:\www\weibodemo\index.php on line 13

Open index.php, found $_server[' Script_uri '],$_server parameters There is no this script_uri, forget it, click on the following link, then error: Sorry, that page doesn ' t exist !

Here, it is estimated that a lot of people will give up, suddenly do not know what to do. In fact, do not put Sina Weibo this write application development think so advanced, the average person is able to see clearly. Take a closer look at index.php, just click on the link address is Weibooauth This class inside the Getauthorizeurl this method generated, and with the next callback function, that is, callback.php file.

From here, it is not difficult to think of this process: first get the local configuration file config.php in the app key and app SECRET, and then must be to verify that the app key is legitimate, and also ask us whether to authorize the app to sync updates Weibo, if the conditions are established, Then return to the local through the callback.php, we can on this callback page to write micro-blog, and finally click on the publication, from the t.sina.com.cn Sina official Weibo log in to see just the article message, the following should be marked "from XXX"

Understanding this principle is not difficult, the $_server[' Script_uri ' changed to our local address, that is, the address of the directory virtual domain name, so that the return to the callback.php, so that there will be no page errors found. For example: my local virtual depressed is http://localhost.com, know D:/www/This folder, my Weibodemo folder is placed under the/www/, then I will $_server[' Script_uri '] change to http:// Localhost.com/weibodemo, even the/callback.php on the back is OK.

This can be displayed after the "Authorization Complete", click into your microblogging interface weobolist.php, go in, you surprised: pretty rough ah, no style, simple HTML form, haha, Sina Weibo programmer how so lazy ah. Hurriedly send a micro bo, test it, in the heart excited bar, hehe.

We can summarize, in fact, quite simple, a total of 6 files: config.php is a configuration file, through the index.php access to Sina Weibo authentication authorization page, after agreeing to authorize Go back to the callback.php page, click on my Weibo, go to the Weibo post and List page weibolist.php, and then post the Weibo, OK. The rest of the file weibooauth.php is a class file, loaded with many classes and functions, are used in the previous, interested can study, can not ignore it. One more. Ds_stor do not know what things, open is garbled, also regardless of, estimated no use.

In addition, remind the attention of the page encoding format, appear garbled of their own patient debugging.
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.