LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-02-2005, 05:27 AM   #1
matthewchin
Member
 
Registered: Jun 2003
Posts: 40

Rep: Reputation: 15
Extract selection list from another site


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>
 
Old 12-05-2005, 09:14 PM   #2
matthewchin
Member
 
Registered: Jun 2003
Posts: 40

Original Poster
Rep: Reputation: 15
Pls close it's resolved.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Do you know sourceforge site? How to upload to this site? TruongAn General 2 07-02-2005 06:26 AM
Low RPM List Selection For LE2005 EHCanadian Mandriva 2 06-23-2005 03:36 AM
get list of latest list of packages bobwall Linux - Distributions 1 11-30-2004 04:48 PM
Syndicated Search/Embed List of My Threads in My Site... kierl LQ Suggestions & Feedback 3 10-09-2004 03:08 PM
wireless channel list different from router's list heluani Linux - Laptop and Netbook 1 08-29-2004 11:04 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration