Tag Archives: twitter

How to validate a Twitter username using Regex

Questions: I have used the pattern /[a-z0-9_]+/i within the function: function validate_twitter($username) { if (eregi(‘/[a-z0-9_]+/i’, $username)) { return true; } } With this, I test if the input is a valid twitter username, but i’m having difficulties as it is not giving me a valid result. Can someone help me find a solution. Answers:

Parsing Twitter API Datestamp

Questions: I’m using the twitter API to return a list of status updates and the times they were created. It’s returning the creation date in the following format: Fri Apr 09 12:53:54 +0000 2010 What’s the simplest way (with PHP or Javascript) to format this like 09-04-2010? Answers:

Twitter OAuth (PHP): Need good, basic example to get started

Questions: 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. 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… Read More »

Regex to conditionally replace Twitter hashtags with hyperlinks

Questions: I’m writing a small PHP script to grab the latest half dozen Twitter status updates from a user feed and format them for display on a webpage. As part of this I need a regex replace to rewrite hashtags as hyperlinks to search.twitter.com. Initially I tried to use: <?php $strTweet = preg_replace(‘/(^|\s)#(\w+)/’, ‘\1#<a href=”http://search.twitter.com/search?q=%23\2″>\2</a>’,… Read More »

Dynamically load information to Twitter Bootstrap modal

Questions: Problem: I would like to transfer by using jQuery a value in an link-attribute to PHP/SQL query. HTML code: <a data-toggle=”modal” href=”#myModal” id=”1″><i class=”pull-right icon-eye-open”></i>HTML</a> PHP code: <div id=”myModal” class=”modal hide fade”> <div class=”modal-header”> <button class=”close” data-dismiss=”modal”>&times;</button> <h3>Title</h3> </div> <div class=”modal-body”> <?php $query = “SELECT * FROM table WHERE id = ID FROM JQUERY… Read More »

Can we get email ID from Twitter oauth API?

Questions: How to get email id of the user who accepted my Twitter application? I have gone through lot of forums. But they have mentioned, it is not possible. Also those posts are older than a year. May I know whether it is possible to get the user email id through twitter API using PHP?… Read More »

PHP Twitter API – How to pull in multiple users tweets?

Questions: How would I go about pulling in tweets from multiple twitter users with PHP and displaying them as part of one combined list on my page? Answers: Use the search API and boolean OR operator. For example here is the URL for CNN Breaking News and NPR All Things Considered: http://search.twitter.com/search.json?q=from%3acnnbrk+OR+from%3anpratc The query is… Read More »

Upload Images On Twitter Using PHP

Questions: How i can upload image on Twitter Wall using consumer_key and consumer_secret without login using PHP? Please help me & thanks a lot. Answers: Well I get the answer, Download Twitter Api for php & created one function. function image_upload(){ define( ‘YOUR_CONSUMER_KEY’ , ‘your twitter app consumer key’); define( ‘YOUR_CONSUMER_SECRET’ , ‘your twitter app… Read More »