note 23940 deleted from function.fopen by dams
| From: | dams@php.net | Date: | Sat, 03 Aug 2002 03:05:56 +0000 |
| Subject: | note 23940 deleted from function.fopen by dams | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-34182@lists.php.net to get a copy of this message | ||
This is sample fopen() script to grabber exchange rates from www.klikbca.com :
<?
$url = "http://www.klikbca.com/website/indo/price_rate/exchange_rate.html";
// Trailing slash when not using filename
$html_start = "<table border=\"0\" cellpadding=\"2\"
cellspacing=\"2\" width=\"100%\">";
$html_end = "<!--- Mulai proses untuk yang BN----->";
// Start grabber of content
ini_set('max_execution_time', '0');
flush ();
$fd= fread(fopen("$url", "r"), 9999);
if ($fd)
{
$a = strpos($fd, "$html_start");
$b = strpos($fd, "$html_end");
$c = $b-$a;
$show = Substr($fd, $a, $c);
}
// Editing html code
$show = ereg_replace("<table border=\"0\" cellpadding=\"2\"
cellspacing=\"2\" width=\"100%\">", "<table border=0
cellspacing=1 cellpanding=0 width=200>", $show);
// Show finish code
echo "<h2>Exchange Rates : \$US-Rp</h2>\n";
echo $show;
flush ();
?>
Easy and fast! :)
http://www.creative-labs.org/php/