使用crul抓取内容的时候。我发现如果截取的内容少。能正常输入。一旦截取的内容多。就只显示Array();了。。这是为什么。。还有就是我要抓取的是表格。中的某一项。没特征。。求思路~~~
建议把你的代码贴出来以供分析
<html> <head> <title></title><link href="/css/newcss/project.css" rel="stylesheet" type="text/css"> </head> <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="overflow:auto;"> <form name="form" method="post"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td class="Linetop"></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0" class="title" id="tblHead"><tr> <td width="80%" > <table border="0" align="left" cellpadding="0" cellspacing="0" > <tr> <td> </td> <td valign="middle"> <b>本学期成绩查询列表</b> </td> </tr> </table> </td> <td width="20%" > <table border="0" align="left" cellpadding="0" cellspacing="0" width="100%" > <tr> <td> </td> <td width="5"></td> </tr> </table> </td> </tr></table><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td class="Linetop"></td></tr></table> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="titleTop2"> <tr> <td class="pageAlign"> <table cellpadding="0" width="100%" class="displayTag" cellspacing="1" border="0" id="user"> <thead> <tr> <th align="center" width="10%" class="sortable"> 课程号 </th> <th align="center" width="10%" class="sortable"> 课序号 </th> <th align="center" width="20%" class="sortable"> 课程名 </th> <th align="center" width="20%" class="sortable"> 英文课程名 </th> <th align="center" width="10%" class="sortable"> 学分 </th> <th align="center" width="10%" class="sortable"> 课程属性 </th> <th align="center" width="10%" class="sortable">成绩 </th> </tr> <tr class="odd" onMouseOut="this.className='even';" onMouseOver="this.className='evenfocus';"> <td align="center"> 00002473 </td> <td align="center"> 26 </td> <td align="center"> 形势与政策(六) </td> <td align="center"> Situation and Policy (Ⅵ) </td> <td align="center"> 0 </td> <td align="center"> 综合必修 </td> <td align="center"> </td> </tr> <tr class="odd" onMouseOut="this.className='even';" onMouseOver="this.className='evenfocus';"> <td align="center"> 00002435 </td> <td align="center"> 09 </td> <td align="center"> 文献检索与利用A </td> <td align="center"> Literature Retrieval and Utilization A </td> <td align="center"> 2 </td> <td align="center"> 综合必修 </td> <td align="center"> </td> </tr> <tr class="odd" onMouseOut="this.className='even';" onMouseOver="this.className='evenfocus';"> <td align="center"> 00000406 </td> <td align="center"> 09 </td> <td align="center"> 软件工程导论 </td> <td align="center"> Introduction to Software Engineering </td> <td align="center"> 3 </td> <td align="center"> 专业必修 </td> <td align="center"> </td> </tr> <tr class="odd" onMouseOut="this.className='even';" onMouseOver="this.className='evenfocus';"> <td align="center"> 00001017 </td> <td align="center"> 01 </td> <td align="center"> 软件代码开发技术 </td> <td align="center"> Development Technology for Software Coding </td> <td align="center"> 2.5 </td> <td align="center"> 专业选修 </td> <td align="center"> </td> </tr> <tr class="odd" onMouseOut="this.className='even';" onMouseOver="this.className='evenfocus';"> <td align="center"> 00000995 </td> <td align="center"> 01 </td> <td align="center"> 编译原理A </td> <td align="center"> The Principle of Compiler A </td> <td align="center"> 3 </td> <td align="center"> 专业选修 </td> <td align="center"> </td> </tr> <tr class="odd" onMouseOut="this.className='even';" onMouseOver="this.className='evenfocus';"> <td align="center"> 00000998 </td> <td align="center"> 02 </td> <td align="center"> 大型数据库系统 </td> <td align="center"> Oracle database system </td> <td align="center"> 2.5 </td> <td align="center"> 学科选修 </td> <td align="center"> 88 </td> </tr> <tr class="odd" onMouseOut="this.className='even';" onMouseOver="this.className='evenfocus';"> <td align="center"> SJ000195 </td> <td align="center"> 07 </td> <td align="center"> 综合实训(二) </td> <td align="center"> Comprehensive Practical Training(Ⅱ) </td> <td align="center"> 2 </td> <td align="center"> 实践环节 </td> <td align="center"> </td> </tr> <tr class="odd" onMouseOut="this.className='even';" onMouseOver="this.className='evenfocus';"> <td align="center"> 00005054 </td> <td align="center"> 02 </td> <td align="center"> 信息安全技术B </td> <td align="center"> Information Security Technology B </td> <td align="center"> 2.5 </td> <td align="center"> </td> <td align="center"> </td> </tr> <tr class="odd" onMouseOut="this.className='even';" onMouseOver="this.className='evenfocus';"> <td align="center"> 00004773 </td> <td align="center"> 01 </td> <td align="center"> 软件项目管理B </td> <td align="center"> Project Managenent for Software B </td> <td align="center"> 2.5 </td> <td align="center"> </td> <td align="center"> </td> </tr> </TABLE> <div align="right"> <table width="100%" border="0" cellpadding="0" cellspacing="0" ><tr><td align="right">共9项 第1/1页 <img title="第一页" src="/img/icon/noDownDM2.gif" style="max-width:90%" style="max-width:90%" style="max-width:90%" / alt="使用crul抓取内容的时候。" > <img title="前一页" src="/img/icon/noDownDM_2.gif" style="max-width:90%" style="max-width:90%" style="max-width:90%" / alt="使用crul抓取内容的时候。" ><img title="下一页" src="/img/icon/noUpDM_2.gif" style="max-width:90%" style="max-width:90%" style="max-width:90%" / alt="使用crul抓取内容的时候。" > <img title="最后一页" src="/img/icon/noUpDM2.gif" style="max-width:90%" style="max-width:90%" style="max-width:90%" / alt="使用crul抓取内容的时候。" > 每页显示的记录数 <select name="pageSize" onchange="pageSizeChange()"><option value="10" >10项</option><option value="20" selected='selected'>20项</option><option value="30" >30项</option><option value="40" >40项</option><option value="50" >50项</option><option value="100" >100项</option><option value="200" >200项</option><option value="300" >300项</option></select><input name="page" type="hidden" id="page" value="1"> <input name="currentPage" type="hidden" id="currentPage" value="1"> <input name="pageNo" type="text" id="pageNo" size="3" onKeyPress="return handleEnterOnPageNo();"> <img src="/img/icon/go.gif" name="goto" id="goto" style="max-width:90%" title="跳转到" onClick="forward();" alt="使用crul抓取内容的时候。" ><script type = 'text/javaScript'>function forward(){ if(!(/^([1-9])(\d{0,})(\d{0,})$/.test(document.all.pageNo.value))){ alert("请输入合法的页号!"); document.all.pageNo.focus(); return false; } if(document.all.pageNo.value>1 ){ alert("输入的页数超过了总页数,请重新输入!"); document.all.pageNo.focus(); return false; } window.location.href="/bxqcjcxAction.do?totalrows=9&page="+ document.all.pageNo.value +"&pageSize="+document.all.pageSize.value;}function handleEnterOnPageNo(){ if(event.keyCode == 13) { forward(); return false; } return true;}function pageSizeChange(){ window.location.href="/bxqcjcxAction.do?totalrows=9&pageSize="+document.all.pageSize.value;}function pagination(value){ window.location.href="/bxqcjcxAction.do?totalrows=9&page="+value+"&pageSize="+document.all.pageSize.value;}</script></td></tr></table> </div> </form> </body></html>
我只要课程的名字和分数。。
建议把你的代码贴出来以供分析 求解答、、、
$s=你的串
preg_match_all('#
会不会跟网站的防抓取规则有关呢
$s=你的串
preg_match_all('#
$s=你的串
preg_match_all('#