Extract selection list from another site
Hi,
This should be a coding to use preg_match or preg_match_all, but pls
point me the correct way...to do this ?
I want to extract the selection date list from another site, and then
put to my own as to be selected in horse.php (code as bottom),
when a date selected, the date is parsed as $indate to be append
at end to the link ("http://www.hkjc.com/chinese/racing/raceresult_all.asp?RaceDate=")
for a new enquiry. The horse.php now only try to find the latest date.
But this list is dynamic.. something as follow if view the source:
<select name="raceDate">
<option value='30/11/2005'>30/11/2005</option>
<option value='27/11/2005'>27/11/2005</option>
<option value='23/11/2005'>23/11/2005</option>
:
:
</select>
From "http://www.hkjc.com/chinese/racing/raceresult_all.asp?RaceDate="
Thank You.
Code:
horse.php
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<title>Horse Result</title>
</head>
<body>
Horse Result -
<hr><br>
<?
$file = "http://www.hkjc.com/chinese/racing/Results.asp";
$contents = file($file);
$size = sizeof($contents);
$alldata=implode("\n", $contents);
preg_match_all("|<form.*?>(.*?)</form>|ism",$alldata,$matches);
foreach($matches[1] as $match)
{ $pieces = explode("\n", $match);
$indate = substr($pieces[10], 19);
}
$file = "http://www.hkjc.com/chinese/racing/raceresult_all.asp?RaceDate=" . $indate;
$contents = file($file);
$size = sizeof($contents);
for($i = 0; $i < $size; $i++) {
$alldata = $contents[$i];
echo $alldata; }
?>
</body>
</html>