yingjiunlow Posted June 1, 2012 Share Posted June 1, 2012 Hi there, I've downloaded a lot of .HTML files containing tables of information. My problem is : I'm figuring out how to Batch extract their tables, and INSERT into MYSQL. Example script: <meta name="generator" content="Namo WebEditor"> <meta name="generator" content="Namo WebEditor"> <meta name="generator" content="Namo WebEditor"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=big5"> <title> 碻い厩厩ネ厩虑戈 - 膀セ戈 </title> <meta name="GENERATOR" content="Namo WebEditor"> <meta name="namo-theme" content="Theme\Exotic\Misty City"> </head> <script language="javascript"> function focus(){ document.frm11A.tname.focus(); } </script> <body onload="focus();"> <div id="layer1" style="width:120px; height:81px; position:absolute; left:610px; top:124px; z-index:1;"> <p><font size="2">弧:<br> 酚 240x300</font></p> </div> <p> </p> <form name="frm11A" action="std11a.php?id=11815" method="POST"> <table> <td width="745" align="center" valign="middle"> <p> <a href="std11a.php?id=11815"> <img src="images/std11_htm_smartbutton4.gif" border="0"></a> <a href="std11b.php?id=11815"> <img src="images/std11_htm_smartbutton5.gif" border="0"></a> <a href="std11c.php?id=11815"> <img src="images/std11_htm_smartbutton6.gif" border="0"></a> <a href="std11d.php?id=11815"> <img src="images/std11_htm_smartbutton7.gif" border="0"></a> <a href="std11e.php?id=11815"> <img src="images/std11_htm_smartbutton8.gif" border="0"></a> <input type="button" value="厩ネ靡" onclick="location='std11f.php?id=11815'"></p> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td width="80"> </td> <td width="90"> </td> </tr> </table> <table width="698" height="0" border="1" align="center" cellpadding="1" cellspacing="1" bordercolor="#66CC00" bgcolor="#99CCFF"> <tr> <td width="79">﹎(い)</td> <td colspan="2" width="213"><font color="blue"> <input type=text name="tname" value="窥睶滇" size=10> </td> </font> <td rowspan="4" width="137" align="center" valign="middle"> <img width=120 src="/student/tsunjin/photo/11815.jpg"> </td> <td width="246" rowspan="4" align="center" valign="middle"> 礚酚 </td> </tr> <tr> <td width="79">﹎(璣)</td> <td colspan="2" width="213"><font color="blue"><input type=text name=ename value="CHEE SHU FEI" size=24></td> </font> </tr> <tr> <td width="79">痁</td> <td colspan="2" width="213"> <p><font color="blue"><input type=text name=class value='J3H' size=10>穝痁:<font color="blue"><input type=text name="newclass" value="" size=10></p> </td> </font> </tr> <tr> <td width="79">痁腹</td> <td colspan="2" width="213"><font color="blue"><input type=text name=seat value='2' size=2></td> </font> </tr> <tr> <td width="79">厩腹</td> <td width="213" colspan="2"><font color="blue">11815 </td> <td width="137">璣ゅ痁</td> <td width="246"><font color="blue"><input type=text name="engclass" value="I3G" size="8"></td> </tr> <tr> <td width="79">ō靡腹</td> <td colspan="2" width="213"><font color="blue"><input type=text name=icno value='970213146394' size=14></td> </font> <td width="137"> 璣ゅ痁单</td> <td width="246"> <font color="blue"><input type=text name="enggrade" value="" size="8"></td> </tr> <tr> <td width="79"> <p>臔酚腹絏</p> </td> <td colspan="2" width="213"> <p><font color="blue"><input type=text name=passport value='' size=20></font></p> </td> <td width="137"> 瓣膟</td> <td width="246"> <font color="blue"><input type=text name="national" value="皑ㄓ﹁ㄈ" size=20></td> </tr> <tr> <td width="79">ネら戳</td> <td colspan="2" width="213"><font color="blue"><input type=text name=birthday value='1997-02-13' size=10></td> </font> <td width="137">贺壁</td> <td width="246"><font color="blue"><select name="race"> <option value=''>-</option><option value='笷壁'>笷壁</option><option value='レ痁壁'>レ痁壁</option><option value='膟ネ'>膟ネ</option><option value='壁'>壁</option><option value='壁'>壁</option><option value='地壁'SELECTED>地壁</option></select></font></td> </tr> <tr> <td width="79">厨ネ靡腹</td> <td colspan="2" width="213"><font color="blue"><input type=text name=birthcert value='K984055' size=20></td> </font> <td width="137">﹙毙</td> <td width="246"><font color="blue"><select name="religion"> <option value=''>-</option><option value='ぱ毙'>ぱ毙</option><option value='︱毙'>︱毙</option><option value='毙'>毙</option><option value='膀服毙'>膀服毙</option><option value='地獺ヵ'>地獺ヵ</option><option value='笵毙'>笵毙</option></select></td> </tr> <tr> <td width="79">┦</td> <td colspan="2" width="213"><font color="blue"> <input type=radio name=sex value="╧" >╧ <input type=radio name=sex value="" checked> </td> </font> <td width="137">筿杠</td> <td width="246"><font color="blue"><input type=text name=tel value='90744091' size="34"> </td> </tr> <tr> <td width="79">筿秎</td> <td colspan="4" width="606"><font color="blue"><input type=text name="email" value="" size="60"> </td> </tr> <tr> <td width="79">痁〆</td> <td width="104">:</td> <td width="104">:</td> <td width="137">も矗筿杠</td> <td width="247"><font color="blue"><input type=text name="hp" value="0193348831" size=20> </td> </tr> <tr> <td width="79">羛揭笆</td> <td width="213" colspan="2">:矗礮厩穦-穦</td> <td width="388" colspan="2">:</td> </tr> <tr> <td width="79">ネ(い)</td> <td colspan="2" width="213"><font color="blue"><input type=text name=bornplace value='订℡' size=20></td> </font> <td width="137">盝薄猵</td> <td width="246"><font color="blue"><select name="stymode"> <option value=''>-</option><option value='盝'>盝</option><option value='產'>產</option><option value='盝'>盝</option><option value='克杯'>克杯</option></select></td> </tr> <tr> <td width="79">ネ(璣)</td> <td colspan="2" width="213"><font color="blue"><input type=text name=ebornplace value='KUALA LUMPUR' size=20></td> </font> <td width="137"> <p>膟</p> </td> <td width="246"><font color="blue"> <select name="grandty"> <option value=''>-</option><option value=''></option><option value='產'>產</option><option value='產磃'>產磃</option><option value='狥'>狥</option><option value=''></option><option value='玭'>玭</option><option value='玭窾圭郡'>玭窾圭郡</option><option value='蔼'>蔼</option><option value='打玭'>打玭</option><option value='穝磃'>穝磃</option><option value='褐'>褐</option><option value='褐'SELECTED>褐</option><option value='褐纒━'>褐纒━</option><option value='褐ッ﹚'>褐ッ﹚</option><option value='褐ッ琄'>褐ッ琄</option><option value='褐匪'>褐匪</option><option value='褐玭'>褐玭</option><option value='褐'>褐</option><option value='褐矦バ'>褐矦バ</option><option value='褐砍て'>褐砍て</option><option value='奸'>奸</option><option value='奸炊圭'>奸炊圭</option><option value='約﹁'>約﹁</option><option value='約狥'>約狥</option><option value='約狥瓾'>約狥瓾</option><option value='約狥'>約狥</option><option value='約狥狥拆'>約狥狥拆</option><option value='約狥獺﹜'>約狥獺﹜</option><option value='約狥蔼'>約狥蔼</option><option value='約狥宾郡'>約狥宾郡</option><option value='約狥嘲伦'>約狥嘲伦</option><option value='約狥磃'>約狥磃</option><option value='約狥磃锭'>約狥磃锭</option><option value='約狥处﹁'>約狥处﹁</option><option value='約狥处锭'>約狥处锭</option><option value='約狥礷'>約狥礷</option><option value='約狥穝穦'>約狥穝穦</option><option value='約狥奸'>約狥奸</option><option value='砍て'>砍て</option></select></td> </tr> <tr> <td width="79">羛蹈</td> <td colspan="4" width="606"><font color="blue"> <input type=text name=contactadd1 value='7, JALAN PP 1,' size=60> <input type=text name=contactadd2 value='PERDANA HEIGHTS,' size=60> <input type=text name=contactadd3 value='TAMAN CHERAS,' size=60> <input type=text name=contactadd4 value='43200 SELANGOR.' size=60> </td> </font> </tr> <tr> <td width="79">秎跋絪腹</td> <td colspan="4" width="606"><font color="blue"> <input type=text name=contactpostcode value='43200' size=10></td> </font> </tr> <tr> <td width="79">ッ</td> <td colspan="4" width="606"><font color="blue"> <input type=text name=permanentadd1 value='' size=60> <input type=text name=permanentadd2 value='' size=60> <input type=text name=permanentadd3 value='' size=60> <input type=text name=permanentadd4 value='' size=60> <tr> <td width="79">秎跋絪腹</td> <td colspan="4" width="606"><font color="blue"> <input type=text size=10 name=permanentpostcode value=''></td> </font></tr> <!--- input type="hidden" name=id value='11815' --> <tr> <td width="79">疭舱</td> <td colspan="4" width="606"> <input type=checkbox name=chk1 value=膟ネ/獶地盖 >膟ネ/獶地盖 <input type=checkbox name=chk2 value=盝ネ >盝ネ <input type=checkbox name=chk3 value=ㄌPMRΘ罿ど痁 >ㄌPMRΘ罿ど痁 <input type=checkbox name=chk4 value=ㄌど痙干σど痁 >ㄌど痙干σど痁 <input type=checkbox name=chk5 value=ㄌい参σど痁厩ネ >ㄌい参σど痁厩ネ <input type=checkbox name=chk6 value=ㄌ蝶糵穦某ど痁 >ㄌ蝶糵穦某ど痁 <input type=checkbox name=chk7 value=弄ネ >弄ネ <input type=checkbox name=chk8 value=础痁ネ >础痁ネ <input type=checkbox name=chk9 value=縒い锣厩 checked>縒い锣厩 </td> </tr> </table> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td width="80"> </td> <td width="80"> <input type="hidden" name=id value=11815> </td> </tr> </table> </form> </body> </html> I hope the BIG-5 encoding doesn't matter... Please help... Quote Link to comment https://forums.phpfreaks.com/topic/263492-help-batch-extract-tables-to-mysql/ Share on other sites More sharing options...
requinix Posted June 1, 2012 Share Posted June 1, 2012 So in other words you downloaded a lot of data from a website, apparently about its users, and you want to import that into your own database? Care to elaborate on why? Quote Link to comment https://forums.phpfreaks.com/topic/263492-help-batch-extract-tables-to-mysql/#findComment-1350364 Share on other sites More sharing options...
yingjiunlow Posted June 2, 2012 Author Share Posted June 2, 2012 Actually it ain't about it's users, it's the students from my school. I grabbed my whole class' information, for... fun I guess. Don't get me wrong, I'm not a bad guy or something... It's about 60 of them in total, but I'm finding an efficient way to sort them up. By the way, is there something like AUTOSUBMIT in PHP? Quote Link to comment https://forums.phpfreaks.com/topic/263492-help-batch-extract-tables-to-mysql/#findComment-1350501 Share on other sites More sharing options...
requinix Posted June 2, 2012 Share Posted June 2, 2012 Eh... Use something like DOMDocument to navigate through the HTML, pulling out the bits you want from it. If you've done DOM stuff with JavaScript before then you'll be right at home doing it with PHP. Quote Link to comment https://forums.phpfreaks.com/topic/263492-help-batch-extract-tables-to-mysql/#findComment-1350524 Share on other sites More sharing options...
yingjiunlow Posted June 2, 2012 Author Share Posted June 2, 2012 Gee thanks a lot Quote Link to comment https://forums.phpfreaks.com/topic/263492-help-batch-extract-tables-to-mysql/#findComment-1350558 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.