Permalink
Browse files

Updated path of IronMQ submodule so it will be uploaded. Updated work…

…er to push the tweet to the queue.
  • Loading branch information...
1 parent 5c8c4e1 commit 84a1b538555d67b7042373e47b015ce31bdd31ff @paddyforan paddyforan committed Jan 10, 2012
Showing with 20 additions and 5 deletions.
  1. +5 −2 .gitmodules
  2. +1 −1 run.php
  3. +14 −2 worker/execute.php
  4. 0 { → worker}/lib/IronMQ
View
7 .gitmodules
@@ -1,6 +1,9 @@
[submodule "lib/IronWorker"]
path = lib/IronWorker
url = git://github.com/iron-io/iron_worker_php.git
-[submodule "lib/IronMQ"]
- path = lib/IronMQ
+[submodule "lib/worker/IronMQ"]
+ path = lib/worker/IronMQ
+ url = git://github.com/iron-io/iron_mq_php.git
+[submodule "worker/lib/IronMQ"]
+ path = worker/lib/IronMQ
url = git://github.com/iron-io/iron_mq_php.git
View
2 run.php
@@ -1,6 +1,6 @@
<?php
-include("SimpleWorker.class.php");
+include("lib/IronWorker/SimpleWorker.class.php");
$name = "tweetworker.php-".microtime(true);
View
16 worker/execute.php
@@ -1,10 +1,22 @@
<?php
+include("lib/IronMQ/IronMQ.class.php");
+
function getTweet($query) {
- return file_get_contents("http://search.twitter.com/search.json?q=".$query."&rpp=1");
+ $results = file_get_contents("http://search.twitter.com/search.json?q=".$query."&rpp=1");
+ return $results["results"][0];
}
$config = parse_ini_file('config.ini', true);
-print_r(getTweet($config['twitter']['query']));
+echo "Searching for ".$config['twitter']['query']."...";
+
+$tweet = getTweet($config['twitter']['query']);
+print_r($tweet);
+
+$mq = new IronMQ('config.ini', true);
+
+$response = $mq->postMessage('', "TweetWorker", array("body" => $tweet["text"]));
+
+print_r($response);
?>
View
0 lib/IronMQ → worker/lib/IronMQ
File renamed without changes.

0 comments on commit 84a1b53

Please sign in to comment.