Tag: twitter

Twitter PHP Class Added to Repository

Well I spent a few hours condensing the PHP code that I developed for BrownPHP into a Twitter class that can be downloaded. You can get it PHP class in my code repository.

Take a look at the class and let me know if there are any methods that you would like to have added to the class. Currently there are two main methods.

  1. sendTweet – This method is a popular one that is seems like everyone want to use. It’s a simple method that can be called to tweet something to your Twitter account. This method is very simple and shouldn’t be complicated at all to implement into your own code at all.
  2. getTagCloud – This is another easily implemented method. By providing any Twitter username, this method will generate a Twitter Tag Cloud. If you have never used a Twitter Tag Cloud, it basically can provide a bird’s eye view of the topics that a Twitter user tweets out more regularly.

I won’t get into how integrating your own sites and projects into Twitter can make them more social and viral inducing, but I will say that if you aren’t using Twitter right now you are losing out on a great way to help your brand.

There are so many insightful people on Twitter (granted a lot of trolls too unfortunately) and a lot of great ideas that can culminate by socializing with this community. I myself am going through a re-branding phase. Instead of using my dlbrown06 Twitter account, I will be using the BrownPHP Twitter account to be tweeting about BrownPHP and other PHP interests.

If you are involved in the PHP community, wanting to learn PHP, or are a PHP guru yourself follow BrownPHP. I’ll be sure to follow you as well to continue discussing PHP projects and development.


The BrownPHP Code Repository

I’m going to start doing some reorganizing of the site as you may have already noticed via the new site design. One thing that I would like to do at first is create a code repository.

As I’m building websites I’ve started to build a library of classes. Most of the classes I normally create and would like to share involve integration with Twitter, eBay, Amazon and others. The goal really is to make it easier on PHP coders starting out to implement some of these wonderful services into project of their very own without having to review API documentation for hours. Most of which is poorly written…

So I’ll obviously be adding a Twitter Class into the repository first. Then as time goes on, others will follow. Give me some time to go through the classes and document them properly so that developers don’t need to decipher my code. J

You can get to the BrownPHP Code Repository here or simply click the “Code” link in the top banner of the site. Let me know if there are any classes in particular that you would like me to add to the repository as priority. Most likely I already have a class for whatever you are looking for, just let me know.

If you are as involved and excited about PHP development as I am and want to help new PHP developers out there, please let them know about BrownPHP.com. I would be more than happy to plug any of the projects that you may be working on.


Sponsored Tweets Challenge – Help Me Win and You Get Paid!

Sponsored Tweets has started a challenge to existing members to help bring in new members. The existing member that brings in the most referrals will win $1000. If I win, I will share it with the people that helped me get it! This will be going on for only a few weeks so I don’t have much time.

If I win the $1000, I’ll give $900 of it away! $300 will go to 3 random people that tweet out the link that is posted below and signs up with Sponsored Tweets. The link below will redirect to Twitter with the status that others need to retweet. There will be two links in the status update. The first goes to Sponsored Tweets to sign up and the second goes to this article to describe this competition. Feel free to change the status update anyway you like as long as you keep both links and the @dlbrown06 in it so I get notified that you tweeted it.

I’m pretty sure Sponsored Tweets is a fairly new service, but I have already made some money from it. Let me be clear that I didn’t have to spam the hell out of my followers to make money. The most Sponsored Tweets I have sent out in a day have been 2 and I don’t plan to ever go over that. I don’t want the people I follow to spam me so I certainly don’t want to spam my followers.

I’m confident that if you guys enjoy tweeting, you’ll like this service. Shoemoney showed that he made over $15,000 in ONE month using this. People would pay him a lot of money per tweet for his huge cult following.

So if you enjoy tweeting and there are a lot of people that enjoy reading your tweets, you don’t have anything to lose by trying this out. I’ll keep you guy posted on the results of this and if/when we win! If I do win the contest, that will begin my own contest to give out my prize winnings to the people that helped me get it.

IMPORTANT: Make sure you sign up to Sponsored Tweets with the same Twitter username that you used when you Retweeted the link. If you don’t I won’t know you did both!

MY ST PLUG: If you would like me to tweet about your business, just click, Tweet About Me!


Twitter Lists – Oh the Possbilities!

I have been using Twitter for a little while now and I think most of you can agree that the more time you put into it, the more you get out of it. Without Twitter I would have never connected with so many like minded people. After using the service for awhile I have started following a large number of many interesting people. Now that Twitter Lists has been added to Twitter, I can finally organize this following into groups.

Twitter made creating a new Twitter list so easy that anyone can take advantage of it. In the right sidebar of your profile, simply click the “New list” link. After this, a dialog box will pop up allowing you to name the list and choose whether your would like it to be public or private. Selecting a private list will only give you access to the list and no one else.

I immediately started four different groups that summarize my current four different interests. The lists that I have created I’ll be adding to and maintaining as time goes on. My four lists are:

  • PHP Tweeters: This list includes a majority of the most influential PHP developers and evangelists.
  • SEO Tweeters: Like the PHP list, the SEO lists includes some very noteworthy SEO specialists.
  • iPhone Tweeters: I have this list just because I have an iPhone and I’m interested in the apps, bug fixes and news.
  • Fun Tweeters: Right now, this list only has in the hosts to the 404 podcast. I’ll be adding other interesting tweeters to this list that don’t really relate to any specific category.

So feel free to follow these lists and if you feel like I am leaving some important Tweeters out of a Twitter List just leave a comment or contact me through the blog. Also please comment your lists that you think would be interesting for other people to follow.


Use PHP to Twitter Your Tweets

Are You Active on Twitter?

View Results

Loading ... Loading ...

Show the Twitter Love! :)

Use PHP to Twitter Your Tweets
I recently got an email from a reader asking me if I could help them with a small script to post updates to a Twitter account using PHP. I figured this might be something that a few others might be interested in, so I decided to post about it.

As most of you know, there are a multitude of options when deciding how to to Tweet to Twitter. If you would like to add this functionality to your site so that you don’t have to download an application to your computer, or visit another site, this might be something you would like.

Using the simple script below you, you can post updates to twitter. Please BE ADVISED: this script needs altered to run. As well as some extra code to add your desired functionality.

$username = 'myUserName';
$password = 'myPassword';
$status = urlencode(stripslashes(urldecode('This is a new Tweet!')));

if ($status) {
$tweetUrl = 'http://www.twitter.com/statuses/update.xml';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "$tweetUrl");
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, "status=$status");
curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");

$result = curl_exec($curl);
$resultArray = curl_getinfo($curl);

if ($resultArray['http_code'] == 200)
echo 'Tweet Posted';
else
echo 'Could not post Tweet to Twitter right now. Try again later.';

curl_close($curl);
}

Needed Alterations:

  • Change $username to YOUR username
  • Change $password to YOUR password
  • Edit $status to the Tweet that you want posted.

Code to Add:

  • Some HTML to Tweet dynamically. For example: Use a form like below and have $_POST['new_tweet'] update the $status variable.
  • More Filtering: It would probably be a good idea to add some more filtering to the status so that you can’t just post a blanks status etc. (I could add that easily, but then where would be your opportunity to learn!)
  • Use OOP Practices: Creating a Twitter Class out of the below procedural code would make it much more modular for you in the future. (Again, better for you to do this yourself. Feel free to contact me with any questions.)
  • Add Some Javascript: Adding some Javascript that counts the amount of characters in the Tweet field would be handy to have for your visitors.

Try it out for yourself (Your Twitter Username and Password are NOT being recorded):

Tweet from BrownPHP

Username:

Password:

Tweet:

Tweet from BrownPHP if you like to test it out for yourself. You can also just copy this code, and make the necessary changes. I just wanted to give a small example to give you an idea of what you can do. Let me know what you think about it and if you have any ideas for some code scripts that you would like to see.

If you enjoy using Twitter, you may want to take a look at our Twitter Tag Cloud Service that we provide. You can also download the scripts to run the script from your own site.

Addendum (05/12/10):

This code has been added to the BrownPHP Code Repository if you would like to download it. You can go straight to the download by clicking the BrownPHP Twitter Class


  • BrownPHP Tag Cloud

  • Copyright © 1996-2010 Brown PHP. All rights reserved.
    iDream theme by Templates Next | Powered by WordPress

    Powered by Yahoo! Answers