I posted an article last night about how to implement the API interface application synchronized with Sina Weibo. Some people want to associate this to their own blogs. just like me, when I post an article, a microfile is automatically generated
I posted an article last night about how to implement the API interface application synchronized with Sina Weibo. Some people want to associate this with their own blogs. just like me, when I post an article, a microblog is automatically generated. How can I skip the intermediate Authentication Authorization and directly generate and send Weibo messages? Please look down!
Configure the file, authorize it to your Weibo account, and then streamline the file.
We know that the page for sending weibo is weibolist. php. when you open it, you will find that the information you send will start? Text = xxx is forwarded, so we find the code that accepts the text. it is an if statement, which is finally transmitted using the updata method, we can copy this method to our own file.
We found that the update method used is in the new WeiboClient class, so it first contains the file where the class is located, that is, weibooauth. php, and then the new class.
At this point we doubt, can this be successful? Of course you can't. your app key and app secret haven't been written yet, but this is very simple, because the new WeiboClient class has the parameter, simply replace the constant with your app key and app secret. However, there are four parameters, followed by two: $ _ SESSION ['last _ key'] ['oauth _ token'], $ _ SESSION ['last _ key'] ['oauth _ token_secret ']. Don't worry, the value of print_r ($ _ SESSION) is a 32-bit encrypted string and copied to the corresponding location.
In this way, if the previous configuration and permission verification files are not needed, the weibooauth. php file will be retained. for example, the code I wrote will be written after the article is published:
$ Text = $ art ['title']. "-from Lu Changhong's PHP learning blog http://www.luchanghong.com/article.php? Id = {$ id }";
Include_once ('Weibo/weibooauth. php ');
$ C = new WeiboClient ('Your APP key', 'Your APP secret', '32-bit encrypted string', '32-bit encrypted string ');
$ Text = iconv ('gbk', 'utf-8', $ text); // If you use gbk encoding, convert the encoding, it is best not to change the encoding format of the source file. Otherwise, the source file is garbled.
$ Rr = $ c-> update ($ text );
OK. After you have done this, you can try to synchronize a QQ Microblog. The principle is almost the same.