php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37387 System misstake while opening data from Internet.
Submitted: 2006-05-09 20:06 UTC Modified: 2006-05-10 14:33 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: cherkasov_ivan at mail dot ru Assigned:
Status: Not a bug Package: HTTP related
PHP Version: 4.4.2 OS: w2k sp4 ur1
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cherkasov_ivan at mail dot ru
New email:
PHP Version: OS:

 

 [2006-05-09 20:06 UTC] 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?


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-09 20:09 UTC] 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-10 14:11 UTC] 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-10 14:33 UTC] tony2001@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 22:01:28 2024 UTC