Permalink
Browse files

first attempt

  • Loading branch information...
1 parent 7017ab6 commit a60768610d370d2288f74b5a47d8ab21c43a4d3e @bluerhinos committed Sep 8, 2010
Showing with 64 additions and 0 deletions.
  1. +20 −0 LICENSE
  2. +7 −0 README
  3. +12 −0 examples/publish.php
  4. +25 −0 examples/subscribe.php
  5. 0 phpMQTT.php
View
20 LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2010 Blue Rhinos Consulting | Andrew Milsted
+andrew@bluerhinos.co.uk | http://www.bluerhinos.co.uk
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
7 README
@@ -0,0 +1,7 @@
+Blue Rhinos Consulting
+Andrew Milsted | andrew@bluerhinos.co.uk | http://www.bluerhinos.co.uk | @bluerhinos
+
+A simple php class to connect/publish/subscribe to an MQTT broker
+
+Documentation: Coming Soon
+Source: http://github.com/bluerhinos/phpMQTT
View
@@ -0,0 +1,12 @@
+<?php
+
+require("../phpMQTT.php");
+
+
+$mqtt = new phpMQTT();
+$mqtt->broker("example.com", 1883, "PHP MQTT Client");
+$mqtt->connect();
+$mqtt->publish("bluerhinos/phpMQTT/examples/publishtest","Hello World! at ".date("r"),0);
+$mqtt->close();
+
+?>
View
@@ -0,0 +1,25 @@
+<?php
+
+require("../phpMQTT.php");
+
+
+$mqtt = new phpMQTT();
+$mqtt->broker("example.com", 1883, "PHP MQTT Client");
+$mqtt->connect();
+$topics['ferries/IOW/#'] = array("qos"=>0, "function"=>"procmsg");
+$mqtt->subscribe($topics,0);
+
+while($mqtt->proc()){
+
+}
+
+
+$mqtt->close();
+
+function procmsg($topic,$msg){
+ echo "Msg Recieved: ".date("r")."\nTopic:{$topic}\n$msg\n";
+}
+
+
+
+?>
View
No changes.

0 comments on commit a607686

Please sign in to comment.