Page 1 of 1

Weird behaviour using \cli\php.exe and fsockopen ?

Posted: Thu Jan 08, 2004 10:54 am
by GHOLYOAK
I have had to develop a class that gets/posts to other sites (loosely based on snoopy) using only fsockopen (not curl).

After many hours coding, I've now been happily getting and posting to all sorts of servers including https: (not using curl), logging into secure sites by posting forms, playing with cookies etc. etc.

Not a single problem interactively that is.

I've created a batch job that runs every 30 mins to extract some info from other sites using the CLI interface

example :-

Code: Select all

php\cli\php.exe getstuff.php
This also works fine until its been running for several hours e.g. 4+ times.

Then suddenly it stops returning data and I can't run it interactively either.

As far as I can tell :-
1. It is definately doing

Code: Select all

fclose
when it should.
2.

Code: Select all

fsockopen
is working e.g. not false !
3. no errors returned by fwrite on the GET blah blah blah bit.
4. no errors returned by fgets, just an empty string.

The really weird part is , I reboot the machine and it starts working again.

Any clues would be appreciated !

PHP Version 4.3.4
W2k sp4