Alright another late night, though I can't complain. 4:30AM is relatively early to sleep nowadays... Just finished doing some work and adding some features to The Grim Tweeper. Now, we store more data so that you won't see the same person twice even if you refresh (unless you cycle through all your followers), and also we keep track of your score so we can set up a leader board and make it more competitive! We shall polish some of these features tomorrow and aim for a re-launch and hope to get picked up by some more big media sites. Though that mention from Time was nice... Another feature I actually helped add last night was something I regret not thinking of earlier... after every 10 kills, a tweet window would pop-up that would essentially say something like 'I just slayed 10 followers via @thetweeper!' I checked this morning and found a lot more tweets about The Grim Tweeper and a vast majority of them were the 'just slayed 10' tweet. So it turned out that was a good way to convert users, to viral tweeters. On a side note, Ajay pointed out to me this article on people who live on no sleep from the Wall Street Journal: The Sleepless Elite Immediately, my egotistical self though OH thats me! I mean, I do really get minimal sleep and have to go to Track and Sprint Football practice. Not that easy. But upon further reading, I realized I am not necessarily among the elite, but just somewhat abnormal. Either way, good read.
After working with Facebook API extensively, the other night I decided it was finally to learn how to connect via Twitter API (little did I know it would keep my up until 7AM). Just a few words on my overall experience that night: it was pretty difficult to understand at first and there was a huge learning curve for me in the beginning, but as soon as I 'got it' it was pretty easy. The biggest reason why I got it was because of Jaisen Mathai. So I started off going straight to Twitter's Dev site and looked right through their tutorial. I thought immediately after reading that it might be a little over my head. They talked a lot about Oauth tokens and the flow between client/server/Twitter authentication and I will admit I was a little lost and discouraged... but I realized Google exists! So next thing I did was Google through 'how to php Twitter API' and opened the first couple results into tabs on Chrome. I skimmed over them all and noticed they all used a little Twitter php class package put together by Jaisen Mathai. I thought, okay seems pretty standard let me download that. I immediately downloaded it from a web site that was NOT Jaisen's because I thought the instructions were a little more clear (sort of a mistake, I will explain), I uploaded onto a server, and started looking at the code. I read through the tutorial and looked through the code and found it was pretty straightforward. As soon as I started playing with it though and customizing it for a simple app I wanted to make, I kept running into issues.
That should have given me a $url with the proper oauth token to go back to Twitter and log a user in to my specific website. However it kept returning a url with the proper url minus the oauth token... I dug into the code and first thing I noticed was in the EpiTwitter class some of the urls were out of date. I tried to change the class variables into the correct ones, then I ran the code again and same issue.. The next thing I did was try to ask @jmathai and hoped that he'd get back to me. He actually responded really quickly saying to email him the question. So I did and while I waited for a response I kept looking online to see if the answer was there. All my search results basically linked back to his page so I decided...you know maybe it was wise to look at what he had to say about his own stuff. I didn't notice anything different until I stumbled upon his Github link to the project. I finally realized that, woops, here was my mistake. His Github contained the most updated code and so I downloaded from there and re-uploaded the library. Boom, baby. It worked. I had gotten a very basic version of logging-in via Twitter up on the server and now it was time to play. Of course also I tweeted back at Jaisen and let him know it was just my mistake of getting old files and he was kind about it. The next thing I did was read through all the documentation of the new classes and learn how it worked. It took a couple tries and it wasn't easy at first. But as soon as I learned the structure of the GET and POST requests it became simply a matter of knowing what Twitter methods were available via the API and how to call them. By the time I became familiar everything it was probably 4AM, so I spent the remainder of the night just coding a basic functioning version of the app I wanted to make (details will be released with the app later this weekend, hopefully tonight). It was a great experience and now I know how to deal with the Twitter API! If anyone has any questions about this or needs help getting started, let me know. I feel like I have learned enough to be helpful enough at this point.
<?php $twitterObj = new EpiTwitter($consumer_key,$consumer_secret); $url = $twitterObj->getAuthorizationUrl(); ?>