hongkongtomlam Posted December 7, 2012 Share Posted December 7, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/271705-automatic-copy-and-update-data-from-website-and-put-it-into-databasemysql/ Share on other sites More sharing options...
Christian F. Posted December 7, 2012 Share Posted December 7, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/271705-automatic-copy-and-update-data-from-website-and-put-it-into-databasemysql/#findComment-1398053 Share on other sites More sharing options...
hongkongtomlam Posted December 7, 2012 Author Share Posted December 7, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/271705-automatic-copy-and-update-data-from-website-and-put-it-into-databasemysql/#findComment-1398071 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.