kish89 Posted September 2, 2008 Share Posted September 2, 2008 Hello, I have complex problem up here, so i will appreciate every help. I have mysql table with this structure: |ID| |Auction| |Starts| |Ends | |Price| | Quantity| |Buyer_name| |Email| |Number| 1 1auction 08/10 08/17 2 2auction 08/20 08/27 Now I need some php code which will extract data from html table from auction site, table structure on auction site is like this: <table width="90%" cellpadding="1" cellspacing="0" bgcolor="#efefef" border="0"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="4" bgcolor="#ffffff"> <tr valign="top" bgcolor="#ffffff"> <td colspan="4"><font face="Tahoma,Verdana,Arial" SIZE=2 COLOR=#003399><span style="FONT-SIZE: 10pt; COLOR: #003399; LINE-HEIGHT: 115%; FONT-FAMILY: 'Tahoma','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: HR; mso-ansi-language: HR; mso-bidi-language: AR-SA">Auction: <b><a href="http://www.aukcije.hr/item.php?id=344756" target=_blank><span style="COLOR: #003399; LINE-HEIGHT: 115%; mso-bidi-font-size: 11.0pt">1auction</span></a></b> (Number: <a href="http://www.aukcije.hr/item.php?id=344756" target=_blank><span style="COLOR: #003399; LINE-HEIGHT: 115%; mso-bidi-font-size: 11.0pt">344756</span></a> – 08/17) </span> </font> </td> </tr> <tr bgcolor="#ffffff"> <td width="33%" bgcolor="#eeeeee"><font face="Tahoma,Verdana,Arial" SIZE=2 COLOR=#003399><span style="FONT-SIZE: 10pt; COLOR: #003399; LINE-HEIGHT: 115%; FONT-FAMILY: 'Tahoma','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: HR; mso-ansi-language: HR; mso-bidi-language: AR-SA">Buyer name </span> </font> </td> <td width="33%" bgcolor="#eeeeee"><font face="Tahoma,Verdana,Arial" SIZE=2 COLOR=#003399>E-mail</font> </td> <td width="17%" bgcolor="#eeeeee"><font face="Tahoma,Verdana,Arial" SIZE=2 COLOR=#003399> Price</font> </td> <td width="17%" bgcolor="#eeeeee"><font face="Tahoma,Verdana,Arial" SIZE=2 COLOR=#003399>Quantity</font> </td> </tr> <tr> <td width="33%" bgcolor="#ffffff"><font face="Tahoma,Verdana,Arial" SIZE=2 COLOR=#003399> <span><font face="Tahoma,Verdana,Arial" SIZE=2 COLOR=#003399>buyer1</font></span> <a href="feedback.php?auction_id=344770&id=20508" ><b> Sendcommen</b></a>t</font> </td> <td width="33%" bgcolor="#ffffff"><font face="Tahoma,Verdana,Arial" SIZE=2 COLOR=#003399> <a href="mailto:[email protected]" > [email protected] </a></font> </td> <td width="17%" bgcolor="#ffffff"><font face="Tahoma,Verdana,Arial" SIZE=2 COLOR=#003399> 52,00</font> </td> <td width="17%" bgcolor="#ffffff"><font face="Tahoma,Verdana,Arial" SIZE=2 COLOR=#003399> 1</font> </td> </tr> <tr> <td colspan="4" bgcolor="#ffffff"> </td> </tr> <tr valign="top" bgcolor="#ffffff"> <td colspan="4"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#000000"><img height="1" src="./images/transparent.gif" width="1"></td> </tr> </table></td> </tr> <tr valign="top" bgcolor="#ffffff"> <td colspan="4"><font face="Tahoma,Verdana,Arial" SIZE=2 COLOR=#003399><span style="FONT-SIZE: 10pt; COLOR: #003399; LINE-HEIGHT: 115%; FONT-FAMILY: 'Tahoma','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: HR; mso-ansi-language: HR; mso-bidi-language: AR-SA">Auction: <b>2auction</b> (Number: <a href="http://www.aukcije.hr/item.php?id=344770" target=_blank><span style="COLOR: #003399; LINE-HEIGHT: 115%; mso-bidi-font-size: 11.0pt">344770</span></a> – 08/27) </span> </font> </td> </tr> <tr bgcolor="#ffffff"> <td width="33%" bgcolor="#eeeeee"><font face="Tahoma,Verdana,Arial" SIZE=2 COLOR=#003399><span style="FONT-SIZE: 10pt; COLOR: #003399; LINE-HEIGHT: 115%; FONT-FAMILY: 'Tahoma','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: HR; mso-ansi-language: HR; mso-bidi-language: AR-SA">Buyer name </span> </font> </td> <td width="33%" bgcolor="#eeeeee"><font face="Tahoma,Verdana,Arial" SIZE=2 COLOR=#003399>E-mail</font> </td> <td width="17%" bgcolor="#eeeeee"><font face="Tahoma,Verdana,Arial" SIZE=2 COLOR=#003399><span style="FONT-SIZE: 10pt; COLOR: #003399; LINE-HEIGHT: 115%; FONT-FAMILY: 'Tahoma','sans-serif'; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: HR; mso-ansi-language: HR; mso-bidi-language: AR-SA">Price</span> </font> </td> <td width="17%" bgcolor="#eeeeee"><font face="Tahoma,Verdana,Arial" SIZE=2 COLOR=#003399>Quantity</font> </td> </tr> <tr> <td width="33%" bgcolor="#ffffff"><font face="Tahoma,Verdana,Arial" SIZE=2 COLOR=#003399> <span><font face="Tahoma,Verdana,Arial" SIZE=2 COLOR=#003399>buyer2</font></span> <a href="feedback.php?auction_id=344770&id=20508" ><b> Sendcomment</b></a> <br></font> </td> <td width="33%" bgcolor="#ffffff"><font face="Tahoma,Verdana,Arial" SIZE=2 COLOR=#003399><a href="mailto:[email protected]">[email protected]</a></font> </td> <td width="17%" bgcolor="#ffffff"><font face="Tahoma,Verdana,Arial" SIZE=2 COLOR=#003399> 30,00</font> </td> <td width="17%" bgcolor="#ffffff"><font face="Tahoma,Verdana,Arial" SIZE=2 COLOR=#003399> 1</font> </td> </tr> <tr> <td colspan="4" bgcolor="#ffffff"> </td> </tr> <tr valign="top" bgcolor="#ffffff"> <td colspan="4"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#000000"><img height="1" src="./images/transparent.gif" width="1"></td> </tr> </table></td></tr></table></tr></table> Php code needs extract data from this fields in html table: „Auction“ , „Price“ , „Quantity“ ,„Buyer name“ , „E-mail“ and„Number“. When script extracts that data, it needs to enter that data to mysql database, but it needs to do some comparison. So if extracted auction name is „1auction“ it compares that name with auction name which is in database and adds all extracted data for that auction in database. Sorry for my bad english but I hope so you know what I need. Thank you! Link to comment https://forums.phpfreaks.com/topic/122453-complex-problem/ Share on other sites More sharing options...
DarkWater Posted September 2, 2008 Share Posted September 2, 2008 What format are Starts and Ends in the database? They should be DATE, not VARCHAR, which I think you have them as. Please verify. xD EDIT: I swear you had put "date" and not "data". I probably just can't read though, so ignore me. xD Read cooldude's post. Link to comment https://forums.phpfreaks.com/topic/122453-complex-problem/#findComment-632279 Share on other sites More sharing options...
cooldude832 Posted September 2, 2008 Share Posted September 2, 2008 Its not that complex You need to reverse engineer the first page (google php html reverse engineering tutorial) Then from there break it down into each "row" and query against the db for matches if no match do an insert Functions you might use striptags preg_match foreach Link to comment https://forums.phpfreaks.com/topic/122453-complex-problem/#findComment-632281 Share on other sites More sharing options...
kish89 Posted September 2, 2008 Author Share Posted September 2, 2008 I think it's ok for date to be in VARCHAR , thats not important. @cooldude832 I will look for code, but till then , do you have some examples? Link to comment https://forums.phpfreaks.com/topic/122453-complex-problem/#findComment-632285 Share on other sites More sharing options...
cooldude832 Posted September 3, 2008 Share Posted September 3, 2008 I think it's ok for date to be in VARCHAR , thats not important. @cooldude832 I will look for code, but till then , do you have some examples? 1) Yes its that important because then u have search abilities by dates instead of by strings (huge bonus especially in an auction system) 1b) You can return formatted dates much more easily 1c) Less space because date = integer 2) No I don't have examples. Link to comment https://forums.phpfreaks.com/topic/122453-complex-problem/#findComment-632362 Share on other sites More sharing options...
kish89 Posted September 3, 2008 Author Share Posted September 3, 2008 Well I can then add TIME format . I've checked for reverse engineering on google but got nothing special. Can somebody please help. Thank you. Link to comment https://forums.phpfreaks.com/topic/122453-complex-problem/#findComment-632557 Share on other sites More sharing options...
kish89 Posted September 3, 2008 Author Share Posted September 3, 2008 Can anyone help? THanks. Link to comment https://forums.phpfreaks.com/topic/122453-complex-problem/#findComment-633024 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.