Re: [PHP] Using File to count number of lines

2005-08-04 Thread Sebastian

you sure each is on its own line (\n) ?

if you're only getting a value of 1 it is likely putting everything on a 
single array key..




Tom Chubb wrote:


I'm having a problem with the following code:

?php 
$file = http://www.mysite.co.uk/mailing_list_database.list;; 
$lines = count(file($file));  
echo $lines ; 
?


I'm trying to show the number of subscribers to my visitors from a
text file, but it returns a value of 1 when it should be 5000.
I think it's to do with recognising the line break but I don't know
how to make it work!?!

(I've looked on php.net for the file, fopen  count functions and
can't find anything, although fopen mentions using the -t mode.
Any ideas?

Thanks,

Tom

 




--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.9/62 - Release Date: 8/2/2005

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



Re: [PHP] Using File to count number of lines

2005-08-04 Thread Tom Chubb
When I open the list in notepad everything is on one line with a
square box character.
When I open it in wordpad, it's one email address on each line.


On 04/08/05, Sebastian [EMAIL PROTECTED] wrote:
 you sure each is on its own line (\n) ?
 
 if you're only getting a value of 1 it is likely putting everything on a
 single array key..
 
 
 
 Tom Chubb wrote:
 
 I'm having a problem with the following code:
 
 ?php
 $file = http://www.mysite.co.uk/mailing_list_database.list;;
 $lines = count(file($file));
 echo $lines ;
 ?
 
 I'm trying to show the number of subscribers to my visitors from a
 text file, but it returns a value of 1 when it should be 5000.
 I think it's to do with recognising the line break but I don't know
 how to make it work!?!
 
 (I've looked on php.net for the file, fopen  count functions and
 can't find anything, although fopen mentions using the -t mode.
 Any ideas?
 
 Thanks,
 
 Tom
 
 
 
 
 
 --
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.338 / Virus Database: 267.9.9/62 - Release Date: 8/2/2005
 
 


-- 
Tom Chubb
[EMAIL PROTECTED]
07915 053312

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



RE: [PHP] Using File to count number of lines

2005-08-04 Thread Jay Blanchard
[snip]
When I open the list in notepad everything is on one line with a
square box character.
When I open it in wordpad, it's one email address on each line.
[/snip]

Sounds like that there are not any newline characters in the file. You
could do something like this...

$theFile = fopen(http://www.mysite.co.uk/mailing_list_database.list;,
r);
while(!feof($theFile)){
   $theLine = fgets($theFile, 4096);
   $theCount++;
}
fclose($theFile);

echo $theCount;

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



Re: [PHP] Using File to count number of lines

2005-08-04 Thread Sebastian

do this:

$file = 'http://www.mysite.co.uk/mailing_list_database.list';

echo 'pre';
print_r($file);
echo '/pre';

im pretty sure you'll only see 1 key..
if each has its own line, you would see something like:

Array
(
   [0] = foo
   [1] = foo
   [2] = foo
   [3] = foo
)

etc...


Tom Chubb wrote:


When I open the list in notepad everything is on one line with a
square box character.
When I open it in wordpad, it's one email address on each line.


On 04/08/05, Sebastian [EMAIL PROTECTED] wrote:
 


you sure each is on its own line (\n) ?

if you're only getting a value of 1 it is likely putting everything on a
single array key..



Tom Chubb wrote:

   


I'm having a problem with the following code:

?php
$file = http://www.mysite.co.uk/mailing_list_database.list;;
$lines = count(file($file));
echo $lines ;
?

I'm trying to show the number of subscribers to my visitors from a
text file, but it returns a value of 1 when it should be 5000.
I think it's to do with recognising the line break but I don't know
how to make it work!?!

(I've looked on php.net for the file, fopen  count functions and
can't find anything, although fopen mentions using the -t mode.
Any ideas?

Thanks,

Tom



 


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.9/62 - Release Date: 8/2/2005


   




 




--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.9/62 - Release Date: 8/2/2005

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



Re: [PHP] Using File to count number of lines

2005-08-04 Thread Sebastian

sorry, i forgot to put file();

Sebastian wrote:


do this:

$file = 'http://www.mysite.co.uk/mailing_list_database.list';

echo 'pre';
print_r($file);
echo '/pre';

im pretty sure you'll only see 1 key..
if each has its own line, you would see something like:

Array
(
   [0] = foo
   [1] = foo
   [2] = foo
   [3] = foo
)

etc...


Tom Chubb wrote:


When I open the list in notepad everything is on one line with a
square box character.
When I open it in wordpad, it's one email address on each line.


On 04/08/05, Sebastian [EMAIL PROTECTED] wrote:
 


you sure each is on its own line (\n) ?

if you're only getting a value of 1 it is likely putting everything 
on a

single array key..



Tom Chubb wrote:

  


I'm having a problem with the following code:

?php
$file = http://www.mysite.co.uk/mailing_list_database.list;;
$lines = count(file($file));
echo $lines ;
?

I'm trying to show the number of subscribers to my visitors from a
text file, but it returns a value of 1 when it should be 5000.
I think it's to do with recognising the line break but I don't know
how to make it work!?!

(I've looked on php.net for the file, fopen  count functions and
can't find anything, although fopen mentions using the -t mode.
Any ideas?

Thanks,

Tom






--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.9/62 - Release Date: 8/2/2005


  




 







--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.9/62 - Release Date: 8/2/2005

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



RE: [PHP] Using @file

2001-12-10 Thread Darren Gamble

Good day,

The error means that it can not resolve the name.

Replace the comma in the name with a period.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 10, 2001 1:24 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Using @file


I am using this line in part of my code but am getting an error that looks
like below:

Code:
$serverDetails =
@file(http://www.myserver,com/versions.php?l=$scripturlv=$version;);

Error:
2: php_network_getaddresses: gethostbyname failed 
(c:\inetpub\wwwroot\yabbse\Sources\Admin.php ln 43)

What would be causing this error?  It works on some machines but not others?

Jeff

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Using @file

2001-12-10 Thread Jeff Lewis

Sorry that was a typo, it is a period, I mistyped into the email.  If it
cant resolve the name, what would cause that problem?

Jeff
- Original Message -
From: Darren Gamble [EMAIL PROTECTED]
To: 'Jeff Lewis' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, December 10, 2001 3:19 PM
Subject: RE: [PHP] Using @file


 Good day,

 The error means that it can not resolve the name.

 Replace the comma in the name with a period.

 
 Darren Gamble
 Planner, Regional Services
 Shaw Cablesystems GP
 630 - 3rd Avenue SW
 Calgary, Alberta, Canada
 T2P 4L4
 (403) 781-4948


 -Original Message-
 From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
 Sent: Monday, December 10, 2001 1:24 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Using @file


 I am using this line in part of my code but am getting an error that looks
 like below:

 Code:
 $serverDetails =
 @file(http://www.myserver,com/versions.php?l=$scripturlv=$version;);

 Error:
 2: php_network_getaddresses: gethostbyname failed
 (c:\inetpub\wwwroot\yabbse\Sources\Admin.php ln 43)

 What would be causing this error?  It works on some machines but not
others?

 Jeff




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Using @file

2001-12-10 Thread Darren Gamble

Good day,

Again, this error means that the server can not resolve a name.

Please ensure that the name www.myserver.com can be DNS resolved.  Please
contact your DNS administrator if it can not.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 10, 2001 1:32 PM
To: Darren Gamble; [EMAIL PROTECTED]
Subject: Re: [PHP] Using @file


Sorry that was a typo, it is a period, I mistyped into the email.  If it
cant resolve the name, what would cause that problem?

Jeff
- Original Message -
From: Darren Gamble [EMAIL PROTECTED]
To: 'Jeff Lewis' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, December 10, 2001 3:19 PM
Subject: RE: [PHP] Using @file


 Good day,

 The error means that it can not resolve the name.

 Replace the comma in the name with a period.

 
 Darren Gamble
 Planner, Regional Services
 Shaw Cablesystems GP
 630 - 3rd Avenue SW
 Calgary, Alberta, Canada
 T2P 4L4
 (403) 781-4948


 -Original Message-
 From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
 Sent: Monday, December 10, 2001 1:24 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Using @file


 I am using this line in part of my code but am getting an error that looks
 like below:

 Code:
 $serverDetails =
 @file(http://www.myserver,com/versions.php?l=$scripturlv=$version;);

 Error:
 2: php_network_getaddresses: gethostbyname failed
 (c:\inetpub\wwwroot\yabbse\Sources\Admin.php ln 43)

 What would be causing this error?  It works on some machines but not
others?

 Jeff



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Using @file

2001-12-10 Thread Jeff Lewis

Again, this works on some servers and othes not.  Does IIS support this
particular function?

Jeff
- Original Message -
From: Darren Gamble [EMAIL PROTECTED]
To: 'Jeff Lewis' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, December 10, 2001 3:32 PM
Subject: RE: [PHP] Using @file


 Good day,

 Again, this error means that the server can not resolve a name.

 Please ensure that the name www.myserver.com can be DNS resolved.  Please
 contact your DNS administrator if it can not.

 -Original Message-
 From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
 Sent: Monday, December 10, 2001 1:32 PM
 To: Darren Gamble; [EMAIL PROTECTED]
 Subject: Re: [PHP] Using @file


 Sorry that was a typo, it is a period, I mistyped into the email.  If it
 cant resolve the name, what would cause that problem?

 Jeff
 - Original Message -
 From: Darren Gamble [EMAIL PROTECTED]
 To: 'Jeff Lewis' [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Monday, December 10, 2001 3:19 PM
 Subject: RE: [PHP] Using @file


  Good day,
 
  The error means that it can not resolve the name.
 
  Replace the comma in the name with a period.
 
  -Original Message-
  From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
  Sent: Monday, December 10, 2001 1:24 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Using @file
 
 
  I am using this line in part of my code but am getting an error that
looks
  like below:
 
  Code:
  $serverDetails =
  @file(http://www.myserver,com/versions.php?l=$scripturlv=$version;);
 
  Error:
  2: php_network_getaddresses: gethostbyname failed
  (c:\inetpub\wwwroot\yabbse\Sources\Admin.php ln 43)
 
  What would be causing this error?  It works on some machines but not
 others?
 
  Jeff
 
 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Using @file

2001-12-10 Thread Darren Gamble

Good day,

While I am sure most of the readers of the list are finding this
conversation amusing, I will still try to explain this a bit better to you.

DNS, or Domain Name Service, is the protocol which translates names into IP
addresses.  If you supply a computer with a name, it must use DNS (or
NetBIOS, or a hosts file, etc.) in order to determine what an IP address is
from a name.

If you have not correctly configured your machine to use DNS, then your
computer will not be able to find the server you are asking it to.  The
error message you have supplied indicates that this is the problem.

From a command prompt on the server you are trying to run this on, try to
ping the server you are trying to reach by name (e.g. ping
www.myserver.com .  If you can not reach the server, then this is the
reason.  If this is the case, please contact the administrator of your
machine/network to correct this problem and take this discussion off the PHP
list.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 10, 2001 1:50 PM
To: Darren Gamble; [EMAIL PROTECTED]
Subject: Re: [PHP] Using @file


Again, this works on some servers and othes not.  Does IIS support this
particular function?

Jeff
- Original Message -
From: Darren Gamble [EMAIL PROTECTED]
To: 'Jeff Lewis' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, December 10, 2001 3:32 PM
Subject: RE: [PHP] Using @file


 Good day,

 Again, this error means that the server can not resolve a name.

 Please ensure that the name www.myserver.com can be DNS resolved.  Please
 contact your DNS administrator if it can not.

 -Original Message-
 From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
 Sent: Monday, December 10, 2001 1:32 PM
 To: Darren Gamble; [EMAIL PROTECTED]
 Subject: Re: [PHP] Using @file


 Sorry that was a typo, it is a period, I mistyped into the email.  If it
 cant resolve the name, what would cause that problem?

 Jeff
 - Original Message -
 From: Darren Gamble [EMAIL PROTECTED]
 To: 'Jeff Lewis' [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Monday, December 10, 2001 3:19 PM
 Subject: RE: [PHP] Using @file


  Good day,
 
  The error means that it can not resolve the name.
 
  Replace the comma in the name with a period.
 
  -Original Message-
  From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
  Sent: Monday, December 10, 2001 1:24 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Using @file
 
 
  I am using this line in part of my code but am getting an error that
looks
  like below:
 
  Code:
  $serverDetails =
  @file(http://www.myserver,com/versions.php?l=$scripturlv=$version;);
 
  Error:
  2: php_network_getaddresses: gethostbyname failed
  (c:\inetpub\wwwroot\yabbse\Sources\Admin.php ln 43)
 
  What would be causing this error?  It works on some machines but not
 others?
 
  Jeff
 
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]