#26885 [Opn-Csd]: When using CLI interface fsockopen fails after several sucessfull attempts

2004-01-20 Thread gholyoak at courtdean dot com
 ID:   26885
 User updated by:  gholyoak at courtdean dot com
 Reported By:  gholyoak at courtdean dot com
-Status:   Open
+Status:   Closed
 Bug Type: Sockets related
 Operating System: w2k
 PHP Version:  4CVS-2004-01-12
 New Comment:

Thanks for that.

I've already tried http/1.1 but as Im trying to emulate a browser, 1.1
has too many extra's that I dont want to code for.

I have been investigating this further and it seems to be an issue with
the firewall.

It would appear that the interactive web version, i.e from IIS is
identified to the firewall as originating from a local IP address (e.g.
localhost or 127.0.0.1) but the CLI version via a batch job is
identified to the firewall as the physical external IP address.

Im still puzzled as to why it started to work after a reboot and then
fail but Im guessing this is a firewall issue.

I will close this report now but thank you for all your assistance to
this point.


Previous Comments:


[2004-01-19 12:21:50] [EMAIL PROTECTED]

Try to use HTTP/1.1, because I think there is no 'Host' in HTTP 1.0.

Maybe the proxy corrects the headers...



[2004-01-14 05:12:36] gholyoak at courtdean dot com

I cannot understand why it works several times then fails.

It works fine on our DEV server which is behind a proxy server, but
fails on the LIV server that has no proxy but has a firewall (Ive
turned the firewall off, but still no joy).

There are no entries in the Event viewer to indicate any problem.

Im at a loss but will keep trying and let you know if I come up with
something.



[2004-01-13 05:09:13] [EMAIL PROTECTED]

I couldn't reproduce the bug with your code.

Hint: This one-liner works fine too:

$xml=file_get_contents(http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml;);

(no need for any fsockopen() stuff at all :)




[2004-01-12 12:13:29] gholyoak at courtdean dot com

I've created a vastly cut-down version of the script :-

?php

$headers = GET /stats/eurofxref/eurofxref-daily.xml
HTTP/1.0\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT
5.0)\r\nHost: www.ecb.int\r\nAccept: image/gif, image/x-xbitmap,
image/jpeg, image/pjpeg, */*\r\n\r\n;

$URI_PARTS = parse_url('http://www.ecb.int/');

$fp = @fsockopen($URI_PARTS['host'],80,$errno,$errstr,10);

if (!$fp){echo 'Cannot open socket';return;}

fwrite($fp,$headers,strlen($headers));
$results = '';
do {
$_data = fread($fp, 50);
if (strlen($_data) == 0) {
break;
}
$results .= $_data;
} while(true);

fclose($fp);

Mail('[EMAIL PROTECTED]','Data Retrieval results',$results);


echo strlen($results);

return;

?


Dont forget to change the email address !!

To replicate the problem:

1. create a w2k .cmd file to call this script
2. Run the .cmd file as many time as you wish and you should get back
an XML doc.
3. create a scheduled task using the .cmd file and run it several
times.

You should notice that it works to start with and then fails but you
can still run the .cmd file interactively ?

Curious ??



[2004-01-12 10:02:03] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with ?php and ends with ?,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try avoid embedding huge scripts into the report.





The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/26885

-- 
Edit this bug report at http://bugs.php.net/?id=26885edit=1


#26885 [Opn]: When using CLI interface fsockopen fails after several sucessfull attempts

2004-01-14 Thread gholyoak at courtdean dot com
 ID:   26885
 User updated by:  gholyoak at courtdean dot com
 Reported By:  gholyoak at courtdean dot com
 Status:   Open
 Bug Type: Sockets related
 Operating System: w2k
 PHP Version:  4CVS-2004-01-12
 New Comment:

I cannot understand why it works several times then fails.

It works fine on our DEV server which is behind a proxy server, but
fails on the LIV server that has no proxy but has a firewall (Ive
turned the firewall off, but still no joy).

There are no entries in the Event viewer to indicate any problem.

Im at a loss but will keep trying and let you know if I come up with
something.


Previous Comments:


[2004-01-13 05:09:13] [EMAIL PROTECTED]

I couldn't reproduce the bug with your code.

Hint: This one-liner works fine too:

$xml=file_get_contents(http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml;);

(no need for any fsockopen() stuff at all :)




[2004-01-12 12:13:29] gholyoak at courtdean dot com

I've created a vastly cut-down version of the script :-

?php

$headers = GET /stats/eurofxref/eurofxref-daily.xml
HTTP/1.0\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT
5.0)\r\nHost: www.ecb.int\r\nAccept: image/gif, image/x-xbitmap,
image/jpeg, image/pjpeg, */*\r\n\r\n;

$URI_PARTS = parse_url('http://www.ecb.int/');

$fp = @fsockopen($URI_PARTS['host'],80,$errno,$errstr,10);

if (!$fp){echo 'Cannot open socket';return;}

fwrite($fp,$headers,strlen($headers));
$results = '';
do {
$_data = fread($fp, 50);
if (strlen($_data) == 0) {
break;
}
$results .= $_data;
} while(true);

fclose($fp);

Mail('[EMAIL PROTECTED]','Data Retrieval results',$results);


echo strlen($results);

return;

?


Dont forget to change the email address !!

To replicate the problem:

1. create a w2k .cmd file to call this script
2. Run the .cmd file as many time as you wish and you should get back
an XML doc.
3. create a scheduled task using the .cmd file and run it several
times.

You should notice that it works to start with and then fails but you
can still run the .cmd file interactively ?

Curious ??



[2004-01-12 10:02:03] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with ?php and ends with ?,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try avoid embedding huge scripts into the report.





[2004-01-12 09:10:31] gholyoak at courtdean dot com

Description:

I have a .cmd file scheduled to run every 30 mins in format:

c:\php\cli\php.exe batch_file.php

that downloads information from another site using fsockopen().

The scripts runs sucessfully for approximately 4 times then although
fsockopen is sucessful, no data is returned.

But I can run the scripts interactively through the web-site interface
as many times as I wish.

The script will not work again until I re-boot ?






-- 
Edit this bug report at http://bugs.php.net/?id=26885edit=1


#26885 [NEW]: When using CLI interface fsockopen fails after several sucessfull attempts

2004-01-12 Thread gholyoak at courtdean dot com
From: gholyoak at courtdean dot com
Operating system: w2k
PHP version:  4.3.4
PHP Bug Type: Sockets related
Bug description:  When using CLI interface fsockopen fails after several sucessfull 
attempts

Description:

I have a .cmd file scheduled to run every 30 mins in format:

c:\php\cli\php.exe batch_file.php

that downloads information from another site using fsockopen().

The scripts runs sucessfully for approximately 4 times then although
fsockopen is sucessful, no data is returned.

But I can run the scripts interactively through the web-site interface as
many times as I wish.

The script will not work again until I re-boot ?


-- 
Edit bug report at http://bugs.php.net/?id=26885edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26885r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26885r=trysnapshot5
Fixed in CVS:   http://bugs.php.net/fix.php?id=26885r=fixedcvs
Fixed in release:   http://bugs.php.net/fix.php?id=26885r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26885r=needtrace
Need Reproduce Script:  http://bugs.php.net/fix.php?id=26885r=needscript
Try newer version:  http://bugs.php.net/fix.php?id=26885r=oldversion
Not developer issue:http://bugs.php.net/fix.php?id=26885r=support
Expected behavior:  http://bugs.php.net/fix.php?id=26885r=notwrong
Not enough info:http://bugs.php.net/fix.php?id=26885r=notenoughinfo
Submitted twice:http://bugs.php.net/fix.php?id=26885r=submittedtwice
register_globals:   http://bugs.php.net/fix.php?id=26885r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26885r=php3
Daylight Savings:   http://bugs.php.net/fix.php?id=26885r=dst
IIS Stability:  http://bugs.php.net/fix.php?id=26885r=isapi
Install GNU Sed:http://bugs.php.net/fix.php?id=26885r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26885r=float


#26885 [Fbk-Opn]: When using CLI interface fsockopen fails after several sucessfull attempts

2004-01-12 Thread gholyoak at courtdean dot com
 ID:   26885
 User updated by:  gholyoak at courtdean dot com
 Reported By:  gholyoak at courtdean dot com
-Status:   Feedback
+Status:   Open
 Bug Type: Sockets related
 Operating System: w2k
 PHP Version:  4.3.4
 New Comment:

I've created a vastly cut-down version of the script :-

?php

$headers = GET /stats/eurofxref/eurofxref-daily.xml
HTTP/1.0\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT
5.0)\r\nHost: www.ecb.int\r\nAccept: image/gif, image/x-xbitmap,
image/jpeg, image/pjpeg, */*\r\n\r\n;

$URI_PARTS = parse_url('http://www.ecb.int/');

$fp = @fsockopen($URI_PARTS['host'],80,$errno,$errstr,10);

if (!$fp){echo 'Cannot open socket';return;}

fwrite($fp,$headers,strlen($headers));
$results = '';
do {
$_data = fread($fp, 50);
if (strlen($_data) == 0) {
break;
}
$results .= $_data;
} while(true);

fclose($fp);

Mail('[EMAIL PROTECTED]','Data Retrieval results',$results);


echo strlen($results);

return;

?


Dont forget to change the email address !!

To replicate the problem:

1. create a w2k .cmd file to call this script
2. Run the .cmd file as many time as you wish and you should get back
an XML doc.
3. create a scheduled task using the .cmd file and run it several
times.

You should notice that it works to start with and then fails but you
can still run the .cmd file interactively ?

Curious ??


Previous Comments:


[2004-01-12 10:02:03] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with ?php and ends with ?,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try avoid embedding huge scripts into the report.





[2004-01-12 09:10:31] gholyoak at courtdean dot com

Description:

I have a .cmd file scheduled to run every 30 mins in format:

c:\php\cli\php.exe batch_file.php

that downloads information from another site using fsockopen().

The scripts runs sucessfully for approximately 4 times then although
fsockopen is sucessful, no data is returned.

But I can run the scripts interactively through the web-site interface
as many times as I wish.

The script will not work again until I re-boot ?






-- 
Edit this bug report at http://bugs.php.net/?id=26885edit=1


#26885 [Fbk-Opn]: When using CLI interface fsockopen fails after several sucessfull attempts

2004-01-12 Thread gholyoak at courtdean dot com
 ID:   26885
 User updated by:  gholyoak at courtdean dot com
 Reported By:  gholyoak at courtdean dot com
-Status:   Feedback
+Status:   Open
 Bug Type: Sockets related
 Operating System: w2k
 PHP Version:  4.3.4
 New Comment:

As suggested I have loaded the latest release and still no joy although
the batch job get any results at all now.

I cant understand why the url is bad as its OK for me and I cut/paste
the code to you.

FYI batch job is set to run as same username/password as interactive
user.


Previous Comments:


[2004-01-12 13:04:17] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

The given URL is invalid. Provide a working URL.
Also, try the snapshot first.




[2004-01-12 12:13:29] gholyoak at courtdean dot com

I've created a vastly cut-down version of the script :-

?php

$headers = GET /stats/eurofxref/eurofxref-daily.xml
HTTP/1.0\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT
5.0)\r\nHost: www.ecb.int\r\nAccept: image/gif, image/x-xbitmap,
image/jpeg, image/pjpeg, */*\r\n\r\n;

$URI_PARTS = parse_url('http://www.ecb.int/');

$fp = @fsockopen($URI_PARTS['host'],80,$errno,$errstr,10);

if (!$fp){echo 'Cannot open socket';return;}

fwrite($fp,$headers,strlen($headers));
$results = '';
do {
$_data = fread($fp, 50);
if (strlen($_data) == 0) {
break;
}
$results .= $_data;
} while(true);

fclose($fp);

Mail('[EMAIL PROTECTED]','Data Retrieval results',$results);


echo strlen($results);

return;

?


Dont forget to change the email address !!

To replicate the problem:

1. create a w2k .cmd file to call this script
2. Run the .cmd file as many time as you wish and you should get back
an XML doc.
3. create a scheduled task using the .cmd file and run it several
times.

You should notice that it works to start with and then fails but you
can still run the .cmd file interactively ?

Curious ??



[2004-01-12 10:02:03] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with ?php and ends with ?,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try avoid embedding huge scripts into the report.





[2004-01-12 09:10:31] gholyoak at courtdean dot com

Description:

I have a .cmd file scheduled to run every 30 mins in format:

c:\php\cli\php.exe batch_file.php

that downloads information from another site using fsockopen().

The scripts runs sucessfully for approximately 4 times then although
fsockopen is sucessful, no data is returned.

But I can run the scripts interactively through the web-site interface
as many times as I wish.

The script will not work again until I re-boot ?






-- 
Edit this bug report at http://bugs.php.net/?id=26885edit=1