diff --git a/index.php b/index.php index de524a8..9dfa044 100644 --- a/index.php +++ b/index.php @@ -47,11 +47,11 @@ function get_session(){ $html = curl_exec($ch); - print $html; - $sentHeaders = curl_getinfo($ch, CURLINFO_HEADER_OUT); -print "
Sent headers:
"; -var_dump($sentHeaders); -print "
Sent headers:
"; +// var_dump($sentHeaders); +// print "
Sent headers:
"; -var_dump($sentHeaders); -print "
Sent headers:
"; +// var_dump($sentHeaders); +// print "
";
$time = round(microtime(true) * 1000);
- $url = "https://mytotalconnectcomfort.com/portal/Device/CheckDataSession/".$device."?_=".$time;
+ $url = "https://mytotalconnectcomfort.com/portal/Device/Control/".$device;
// $url = 'http://up.jamesnweber.com/_sandbox/stat/post.php';
global $ch;
@@ -161,13 +161,25 @@ function getStatus($device){
$html = curl_exec($ch);
- print "";
- print $html;
- print "
";
- $sentHeaders = curl_getinfo($ch, CURLINFO_HEADER_OUT);
-print "Sent headers:
";
-var_dump($sentHeaders);
-print "
";
+
+ $re = "/Control.Model.Property\\.(.*), (.*)\\)/";
+ preg_match_all($re, $html, $matches);
+ $data = array();
+ foreach($matches[1] as $key => $match){
+ if(strpos($matches[1][$key], ',') == FALSE){
+ $data[$matches[1][$key]] = $matches[2][$key];
+ }
+ }
+
+ return $data;
+
+ // print "";
+ // print $html;
+ // print "
";
+ // $sentHeaders = curl_getinfo($ch, CURLINFO_HEADER_OUT);
+// print "Sent headers:
";
+// var_dump($sentHeaders);
+// print "
";
}
@@ -179,10 +191,9 @@ function cleanCookies(){
}
get_session();
-login($username, $password);
-getStatus($device_number);
-// cleanCookies();
-// getStatus($device_number);
+//login($username, $password);
+//$data = getStatus($device_number);
+
curl_close($ch);