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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
GHOLYOAK
Forum Newbie
Posts: 7
Joined: Wed Apr 30, 2003 7:12 am

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

Post 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
Post Reply