How to associate Twitter with your magento site oauth1

Source: Internet
Author: User
Public Function post_tweet ($ tweet_text) {include_once ('twitter/tmhoauth. PHP '); // tmhoauth. PHP is a Twitter API and put it under/lib/Twitter. read $ connection = new tmhoauth (Array ('consumer _ key' => 'xrnoml0zzk ...... ', 'consumer _ secret' => 'xfdubpvnj8ljhksax8n9ggsp ...... ', 'user _ token' => 'c9796070-zwyrdlkswm40ssyx0woxy ...... ', 'user _ secret' => 'vdlvawikcml9a9ruxgsarlhjmin ...... ',); // make the API call $ connection-> request ('post', $ connection-> URL ('1/statuses/Update '), array ('status' => $ tweet_text); return $ connection-> response ['code'];}

Instance demand: My magento station will launch a special product every day. At the same time, I want to automatically publish the relevant information of this product to my Twitter to achieve more

People are concerned about the effects of this product and my sites.
Add the following code in helper/data. php:

The above consumer_key, user_token and other parameters will open a new article later on how to register and obtain them.

Then you can use the above function to synchronously update your Twitter. The Code is as follows:
$ Twitter = "product information, such as name and price"; $ return_code = Mage: helper ('yourmode')-> post_tweet ($ Twitter );

Log on to your Twitter account and check that the information has been published!
Tmhoauth. php: http://download.csdn.net/download/shangxiaoxue/3972615

Original article. For more information, see the source!

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.