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, 500000);
        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=26885&edit=1

Reply via email to