I a'm having a nightmare!!
Posted: Thu Mar 09, 2006 12:26 pm
Can anyone help I have come up against a brick wall...
I am opening the http port of a device and would like to filter out some data that is returned. but my regex commands arn't doing what I want...it seems to go a little weird arround the carriage return and new line...
This is the output of the variable $buffer when I echo this...I then do a view source but I cant get find the pattern..
Video buffer underflows (this connection)
1
Ideally what I am after is the value '1' in a variable, this number could go as high as100000...
Can anyone help...
Many Thanks Ian[/quote]
I am opening the http port of a device and would like to filter out some data that is returned. but my regex commands arn't doing what I want...it seems to go a little weird arround the carriage return and new line...
Code: Select all
$pattern = '^(Video buffer underflows \(this connection\)\r\n1)^';
$connection = fopen("http://" .$IP. "/index.htm", "r");
if ($connection) {
while (!feof($connection)) {
$buffer = fgetss($connection, 4096);
$buffer = rtrim($buffer);
preg_match($pattern, $buffer, $match);
//echo $buffer;
print_r($match);
}
fclose($test);
}Video buffer underflows (this connection)
1
Ideally what I am after is the value '1' in a variable, this number could go as high as100000...
Code: Select all
Video buffer overflows (this connection)
0
Video buffer underflows (this connection)
1
Audio continuity errors (this connection)
0Many Thanks Ian[/quote]