Archived
1
0

Grep out update

This commit is contained in:
James Stuckey Weber
2015-02-23 12:26:10 -05:00
parent 8705fe7d08
commit c7b1125cb1

View File

@@ -47,11 +47,11 @@ function get_session(){
$html = curl_exec($ch); $html = curl_exec($ch);
print $html; // print $html;
$sentHeaders = curl_getinfo($ch, CURLINFO_HEADER_OUT); // $sentHeaders = curl_getinfo($ch, CURLINFO_HEADER_OUT);
print "<pre>Sent headers: <br />"; // print "<pre>Sent headers: <br />";
var_dump($sentHeaders); // var_dump($sentHeaders);
print "</pre><br />"; // print "</pre><br />";
} }
@@ -108,11 +108,11 @@ function login($usr, $pwd){
curl_setopt($ch, CURLOPT_POSTFIELDS, $postinfo); curl_setopt($ch, CURLOPT_POSTFIELDS, $postinfo);
$html = curl_exec($ch); $html = curl_exec($ch);
print $html; // print $html;
$sentHeaders = curl_getinfo($ch, CURLINFO_HEADER_OUT); // $sentHeaders = curl_getinfo($ch, CURLINFO_HEADER_OUT);
print "<pre>Sent headers: <br />"; // print "<pre>Sent headers: <br />";
var_dump($sentHeaders); // var_dump($sentHeaders);
print "</pre><br />"; // print "</pre><br />";
} }
@@ -120,7 +120,7 @@ function getStatus($device){
print "<hr><br>Get Status<br><br><pre>"; print "<hr><br>Get Status<br><br><pre>";
$time = round(microtime(true) * 1000); $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'; // $url = 'http://up.jamesnweber.com/_sandbox/stat/post.php';
global $ch; global $ch;
@@ -161,13 +161,25 @@ function getStatus($device){
$html = curl_exec($ch); $html = curl_exec($ch);
print "<pre>";
print $html; $re = "/Control.Model.Property\\.(.*), (.*)\\)/";
print "</pre>"; preg_match_all($re, $html, $matches);
$sentHeaders = curl_getinfo($ch, CURLINFO_HEADER_OUT); $data = array();
print "<pre>Sent headers: <br />"; foreach($matches[1] as $key => $match){
var_dump($sentHeaders); if(strpos($matches[1][$key], ',') == FALSE){
print "</pre><br />"; $data[$matches[1][$key]] = $matches[2][$key];
}
}
return $data;
// print "<pre>";
// print $html;
// print "</pre>";
// $sentHeaders = curl_getinfo($ch, CURLINFO_HEADER_OUT);
// print "<pre>Sent headers: <br />";
// var_dump($sentHeaders);
// print "</pre><br />";
} }
@@ -179,10 +191,9 @@ function cleanCookies(){
} }
get_session(); get_session();
login($username, $password); //login($username, $password);
getStatus($device_number); //$data = getStatus($device_number);
// cleanCookies();
// getStatus($device_number);
curl_close($ch); curl_close($ch);