> Zoran Lorkovic wrote: > > > $file = file_get_contents("text.inc"); > > $start = "[start]"; > > $end = "[/end]"; > > $pos_start = strpos ($file, $start); > > $pos_end = strpos ($file, $end); > > $data = substr ($file, $pos_start, $pos_end); > > mail ("[EMAIL PROTECTED]", "My Subject", $data); > > > > > > This code works when I call it from browser, but when I call it from command line, $data is not put into mail > > (mail is send but it is empty, without any data in body). > > > that would depend from which place you run the script. > file_get_contents("text.inc") will be looked for in: > 1. the current working directory > 2. the included dirs > > So, if you're running the script like: > [EMAIL PROTECTED] /]# cd / > [EMAIL PROTECTED] /]# php -q /var/www/html/scripts/mail.php > then you're actually working in /, so it's looking for "text.inc" in: > /text.inc and in all include-paths.
Yeah! Of course. This was the problem. Script and text file were in 'mydir/public_html' but I call script from 'mydir' so I script looks for text file in 'mydir' because of $file = file_get_contents("text.inc"); For the quick test I've changed this to: $file = file_get_contents("public_html/text.inc"); and now it's working. Thanks a lot! Regards. Zoran -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php