How to implement application oauth and streaming api to existing code that used api 1


Hey guys I am a serious newb with almost no coding knowledge. With that being said I am getting better and had a working code that was tweaked from someone else’s code. I would like this to work in api 1.1 I have all of the oauth credentials but I am not sure how to format and implement them into my code here for application oauth. (I wont have multiple users, which is why I am thinking this is the right one to go with) I also have downloaded some php libraries but I dont know how to implement them into this existing code and how to format the url. Any and all help would be greatly appreciated. I am only looking for a keyword and to open the link within that tweet that matched the keyword. If someone can be really helpful I am willing to compensate I just am at a total loss as to how to fix this!

Thanks again for any assistance!

Here is the code:

var req = new XMLHttpRequest();

function test() {
req.onload = showTweets;

setTimeout(test, 3000);


function showTweets() {
var data = req.responseText;

var tweets = $.parseJSON(data);

$.each(tweets, function (data) {

    var id =;
    var txt = this.text;

if(!txt) {
 	return false;

    var link = txt.substring(txt.indexOf("http://"));
     var linkSplit=link.split(" ");

var lastTweet = localStorage["lastTweet"];

    //var txt = txt.replace("\u2018", "").replace("\u2019", "");
    var z = localStorage["keyword"];

    if (txt.toLowerCase().indexOf("now available") >= 0 && id != lastTweet) {
        if (localStorage["keyword"] && txt.indexOf(localStorage["keyword"]) >= 0) {
            chrome.tabs.create({ url: link });

            localStorage["lastTweet"] = id;

            return false;
    else if (id == lastTweet)
        return false;


function (request, sender, sendResponse) {
if (request.command == “startCheck”) {
setTimeout(test, 3000);
else if (request.command == “stopCheck”) {