Data acquisition is a kind of device, which collects data from external system and input to an interface inside the system. Data acquisition technology is widely used in various fields. such as cameras, microphones, are data acquisition tools.
The collected data is a variety of physical quantities that have been converted into telegraph numbers, such as temperature, water level, wind speed, pressure, etc., which can be analog or digital. Sampling is generally sampled, that is, a time interval (called the sampling period) of the same point data repeatedly collected. Most of the data collected is instantaneous, but also a characteristic value within a certain period of time. Accurate data measurement is the basis of the acquisition. The data measurement method has the contact and the non-contact type, the detection element is various. Regardless of the method and component, the condition of the measured object and the measurement environment are not affected, so as to ensure the correctness of the data. Data acquisition has a wide meaning, including the acquisition of a continuous physical quantity in the opposite form. In computer-aided cartography, mapping and design, the process of digitizing graphics or images can also be called data acquisition, at which point the geometry (or including physical quantities, such as grayscale) is collected.
In the rapid development of the Internet industry today, data acquisition has been widely used in the Internet and distributed areas, the field of data acquisition has undergone significant changes. Firstly, the intelligent data acquisition system in distributed control application has made great progress at home and abroad. Second, the number of bus-compatible data acquisition plugins is increasing, and the number of data acquisition systems compatible with personal computers is increasing. A variety of domestic and foreign data acquisition machine has come out, the data collection into a new era.
Here is a data acquisition class
<? Compatible with PHP4 PHP5//Simple Call method/* <? Include ("ugs.php"); You can download this ugs.phps and rename it to ugs.php $ugs = new UGS (); $url = "Http://domainname.com/path_to_your_target?param"; $ugs->seturl ($url); $ugs->gather (); //............ Here you can call other methods in this class, to adjust the $ugs->value_ to meet your requirements $content = $ugs->getcontent (); Print ($content);?> */Class Ugs {var $value _; ' Target content var $src _; ' Destination URL address function SetUrl ($url) {$this->src_= $url; } function GetContent () {return $this->value_; } function GetFile ($url)//Get target {$url _parsed = Parse_url ($url); $host = $url _parsed["host"]; $port = $url _parsed["Port"]; if ($port ==0) $port = 80; $path = $url _parsed["path"]; if (empty ($path)) $path = "/"; if ($url _parsed["Query"]! = ") $path. ="? ". $url _parsed["Query"]; $out = "GET $path http/1.0\r\nhost: $host \r\n\r\n"; $fp = Fsockopen ($host, $port, $errno, $ERRSTR, 30); Fwrite ($fp, $out); $body = false; while (!feof ($fp)) {$s = fgets ($fp, 1024); if ($body) $in. = $s; if ($s = = "\ r \ n") $body = true; } fclose ($FP); return $in; } function Getfile_curl ($url) {$curl = "/usr/local/bin/curl"; Path to your Curl $curl _options= "-S--connect-timeout--max-time 10"; For Curl usage Please refer to curl--help or man curl/curl parameter is very rich, can simulate various browser (agent) can set referer $cmd = "$curl $curl _options $url "; @exec ($cmd, $o, $r); if ($r!=0) {return "timeout"; } else {$o =join ("", $o); return $o; }} function Gather_curl ($curl) {$http = $this->getfile_curl ($this->src_); return $this->value_= $http; } function Gather_array ($url) {return file ($url); } function gather ()//start collection {$http = $this->getfilE ($this->src_); return $this->value_= $http; } function gather_local ($toline =true)//processing local file {if ($toline) {$http =file ($this- >SRC_); return $this->value_= $this->bytestobstr ($http); } else {$http =file ($this->src_); return $this->value_= $http; }} function Noreturn ()//delete carriage return line {$this->value_=str_replace ("\ n", "", $this->value_); $this->value_=str_replace ("\ R", "", $this->value_); } function Change ($OLDSTR, $STR)//' Replace the individual string in the collected content with the new value/method//' parameter is the old string, the new string {$this->value_=str _replace ($oldStr, $str, $this->value_); The function cut ($start, $end, $no = ' 1 ', $comprise = ')//' cuts the collected content by the specified end-and-end string (not including the string) method//$no must be 3 ... Not allowed is 0//$comprise can choose Start or end or all or nothing {$string =explode ($start, $this->value_); Print_r ($string); $string =explode ($end, $string [$no]); Print_r ($string); Switch ($comprise) {case ' start ': $string = $start. $string [0]; Break Case ' End ': $string = $string [0]. $end; Break Case ' all ': $string = $start. $string [0]. $end; Break Default: $string = $string [0]; } return $this->value_= $string; } function Filt ($head, $bot, $str, $no = ' 1 ', $comprise = ')//' Replace the collected content with the new value by the specified end-to-end string (not including the first string) method//' parameter is a string, a tail string, respectively , the new value, and the new value bit empty, is the filter {$tmp _v= $this->value_; $tmp = $this->cut ($head, $bot, $no, $comprise); return $this->value_=str_replace ($tmp, $str, $tmp _v); } function local () {//' To change the absolute URL address in the collected content to the local relative address//not implemented} function Replacebyreg ($PATRN, $ STR)//' replace/method with a new value for a string that matches the regular expression in the collected content//' parameter is your custom regular expression, the new value {return $this->value_=join ("", Preg_replace ($patrn, $str, $this->value_)); } function debug ()//debug Display {$tempstr = "<script>function RunEx () {var winEx2 = window.open (\" \ ", \" Winex2\ ", \" Width=500,height=300,status=yes,menubar=no,scrollbars=yes,resizable=yes\ "); WinEx2.document.open (\ "text/html\", \ "replace\"); WinEx2.document.write (unescape (Event.srcelement.parentelement.children[0].value)); WinEx2.document.close (); }function SaveFile () {var win=window.open (', ' ', ' top=10000,left=10000 '); Win.document.write ( Document.all.asdf.innerText); Win.document.execCommand (' SaveAs ', ' ', ' javascript.htm '); Win.close ();} </script><center><textarea id=asdf Name=textfield rows=32 wrap=virtual cols=\ "120\" > ". $this Value_. " </textarea><br><br><input Name=button Onclick=runex () Type=button value=\ "View effects \" > <INPUT Name=button onclick=asdf.select () Type=button value=\ "Select All" > <input Name=button onclicK=\ "asdf.value=" \ "Type=button value=\" emptying \ "> <input onclick=savefile (); Type=button value=\ "Save code \" ></center> "; Echo $tempstr; }}?>