#37387 [Opn->Bgs]: System misstake while opening data from Internet.

From: Date: Wed, 10 May 2006 14:33:06 +0000
Subject: #37387 [Opn->Bgs]: System misstake while opening data from Internet.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-96918@lists.php.net to get a copy of this message
ID: 37387 Updated by: tony2001@php.net Reported By: cherkasov_ivan at mail dot ru -Status: Open +Status: Bogus Bug Type: HTTP related Operating System: w2k sp4 ur1 PHP Version: 4.4.2 New Comment: Fixed in CVS long time ago. You have to wait for the next 4.4 release or (which is highly recommended) upgrade to 5.1. Previous Comments: ------------------------------------------------------------------------ [2006-05-10 14:11:23] cherkasov_ivan at mail dot ru Here is an example of PHP code that gives currency exchange courses on a current date. Under Win32 it does not works. On the hosting it works... <?php function get_content() { // Making current date $date = date("d/m/Y"); // Making link $link = "http://www.cbr.ru/scripts/XML_daily.asp?date_req=$date"; // Loading HTML-page $fd = fopen($link, "r"); $text=""; if (!$fd) echo "Requested page not found!"; else { // Reading file to variable $text while (!feof ($fd)) $text .= fgets($fd, 4096); } // Close file descriptor fclose ($fd); return $text; } $content = get_content(); $pattern = "#<Valute ID=\"([^\"]+)[^>]+>[^>]+>([^<]+)[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>([^<]+)[^>]+>[^>]+>([^<]+)#i"; preg_match_all($pattern, $content, $out, PREG_SET_ORDER); $dollar = ""; $euro = ""; foreach($out as $cur) { if($cur[2] == 840) $dollar = str_replace(",",".",$cur[4]); if($cur[2] == 978) $euro = str_replace(",",".",$cur[4]); } $date = date("d.m.Y"); echo "Currency exchange courses on ".$date."<br>"; echo "Dollar - ".$dollar."<br>"; echo "Euro - ".$euro."<br>"; ?> ------------------------------------------------------------------------ [2006-05-09 20:09:47] bjori@php.net 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 to avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2006-05-09 20:06:22] cherkasov_ivan at mail dot ru Description: ------------ I can't to include or get the result of php code or html text from the Internet links. PHP is making a system misstake... W2k tells:" php.exe called misstake and will be closed. Need to restart the program. Created log of misstakes. OK" How can I correct this misstake? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37387&edit=1

« previous php.bugs (#96918) next »