Im looking for a function to post to twitter users posts they make on my website. For example
Message: "hello world" [twitter] Click twitter and it posts message along with page URL. If the mesaage is longer than the twitter max then it shows a abbreviated version.
I at the momment i have an official one that only posts the whole page to twitter and not an individual post/message
This is what ive tried
<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-text"<?php echo $row['id']; echo $row['message']; ?>">Tweet开发者_高级运维</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><br/>
But its still just displaying page name and link to page. Not the post
Can anyone help how to do this and where to get it?
Check out the Twitter API documentation. And more specifically, Authenticating Requests with OAuth.
You can customize the Tweet button by providing the correct url parameters to the widget script
the parameters that you are interested in are: data-text & data-url
For example:
<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://someurl.com" data-text="hello world" data-count="vertical" data-via="richerd">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
You can check out the documentation for the tweet button at: http://twitter.com/about/resources/tweetbutton
精彩评论