Re: Going nuts with this, cant figure out whats the prob

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ryan A wrote:
Hi,

This is my script:

(ryan_debug_write_to_file is my debug function that
writes stuff into a txt file instead of using a
print(), its working without a problem)

------------------------------
$stdin = fopen('php://stdin', 'r');

while ($line = fgets($stdin))
{
	$line=trim($line);
	ryan_debug_write_to_file('In while(),STDIN,
Start..'.$line.'---End ');

	
$pattern="/^(\d+\.\d+\.\d+\.\d+)\|(.+)\|(\d+)\|([\d-]+)\|(.+)\|(.+)$/";
      	if (preg_match($pattern,$line,$m))
/*\|(.+)\|(.+)*/
      	{
ryan_debug_write_to_file('Now in Preg match!');
/* This does not execute for some reason....ARRRRGH*/
....more code here
}
------------------------------

The problem is I never get the "Now in Preg match"
message... I have checked the preg_match by taking the
data and putting it in a file and reading it from
there like this:


-----------------------------------

<pre>
<?php

$stdin = fopen("test.txt", "r");
	while ($line = fgets($stdin))
   	{
		$line=trim($line);
		echo '<b>In while(),Start..'.$line.'---End of
stdin<br></b>';

	
$pattern="/^(\d+\.\d+\.\d+\.\d+)\|(.+)\|(\d+)\|([\d-]+)\|(.+)\|(.+)$/";
      	if (preg_match($pattern,$line,$m))
/*\|(.+)\|(.+)*/
      	{


echo 'Now in Preg match!<br>';
		}
	}
?>
</pre>

-----------------------------------

and it works perfectly, so wheres the damn problem on
top? Spent the better part of 3 hours trying to find
the problem.

(you can download the test.txt script from
ezee.se/test/test.txt) basically, the preg_match is to
match this:

193.150.249.47|-|200|188|/usr/local/www/om/www/pass/coin|-



If you want to see the whole script you can download
it from ezee.se/test/coinpass_problem.php.txt


So pissed I want to take a print out of the script and
burn the sh*t.

If you cat test.txt | script.php

(script.php being the first example)

does it work?

I was wondering if the different line endings (dos/unix) might play a factor but I doubt it.

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux