Jump to content

Automatic Copy And Update Data From Website And Put It Into Database(Mysql)


hongkongtomlam

Recommended Posts

Dear Sir/Madam

 

I have a problem as follows. I need to copy the data(all of them is the table) from website like horse racing and

put it into database by hand frequently. I would like to write a programme to copy data

and then the programme can automatic update and put the data into database from time to time.

 

Like horse racing . I need to select the date frist. and then select the race number. and then click the horse

number one by one and enter each horse racing information history. and copy each into data base.

the procedure like as follows:

 

I select date 1/1/2013, then select race number 1, then click horse number 1,2,3,4,5,6,7,8 one by one

and copy horse 1 racing history (it is a table) and put it into the database , copy horse 2 racing history

and put it into the database....

 

then select race number 2, then click horse number one by one and put each horse history

into databse......

 

the precedure continue like that....

 

Please kindly help how to write this kind of programme and any books can recommend which

teach us how to do similar jobs......

 

Thank you very much for your help

 

Thanks

Tom

Link to comment
Share on other sites

First and foremost I'd ask the owners of that site if they have an API and/or feed for their data. If not, then I'd ask if it was OK with them if I scraped their site.

 

Should the answer to the first question be "no", and "yes" to the last. Then you'll need to look up cURL, MySQLI and DOMdocument.

Have use cURL to fetch the page for the correct date, then fetch the links to all of the races. Next loop through them, and select the links for all of the horses. Once you have all of the links for all of the horses, you can start fetching the individual pages, and fetch the contents of the tables. Which you use to construct a query and (finally), when you've parsed all of the individual horses, use MySQLI to save it to the database.

Link to comment
Share on other sites

Dear Sir,

 

Thanks for your email and great help

 

For example

1. we go to website http://www.macauyydog.com/schedule/racebook.php

and we get the document as files name 1 (which we delete some because file is too much)

 

2. then we select the date and race number and click dog number 1

http://www.macauyydog.com/database/dogs.php?id=QAACH

we get the document as files name 2 (which we delete some because files is too much)

 

because i only attend a short course PHP + SQL and only have little knowledge.

Could these above information can run the programme? Could u have any books recommend

us to read so we have more knowledge about these and can handle

 

Thanks

Tom

1.rtf

2.rtf

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.