Jump to content

[SOLVED] parsing between <table></table>


Recommended Posts

Hi,

I would like to parse the html code and get the data between

<table border="0" cellspacing="0" cellpadding="2" class="ysprow1" width="100%" style="border-collapse: collapse" bordercolor="#111111">

 

</table>

 

html cdoe:

<table border="0" cellspacing="0" cellpadding="2" class="ysprow1" width="100%" style="border-collapse: collapse" bordercolor="#111111"><tr><td class="yspdetailttl" valign="bottom" height="12"> Mon, Dec 8</td></tr><tr><td>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<tr>
<td nowrap> &#149; Kentucky: Big Blue Sports Shows</td>

<td nowrap> 
<span class="yspscores">
<a href="javascript:void(window.open('http://cosmos.bcst.yahoo.com/up/collegetest/?cl=10533242','playerWindow','width=793,height=608,scrollbars=no'));"  ><img border="0" src="http://l.yimg.com/a/i/us/sp/ed/ic/free_audio_box.gif" width="16" height="12" alt="Free Audio"></a> </span></td>
<td nowrap>  </td>
<td width="100%" nowrap class="yspscores"> 6:00 pm EST</td>
</tr>
</table></td></tr>


<tr><td>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<tr>
<td nowrap> &#149; Lehigh <span class='yspscores'><a href="javascript:void(window.open('http://cosmos.bcst.yahoo.com/up/collegetest/?cl=10603183','playerWindow','width=793,height=608,scrollbars=no'));"  ><img border="0" src="http://l.yimg.com/a/i/us/sp/ed/ic/pay_video_box.gif" width="16" height="12" alt="Subscription Video"></a> </span> vs. Albany <span class='yspscores'></span></td>

<td nowrap>  </td>
<td width="100%" nowrap class="yspscores">  6:30 pm EST  </td>
</tr>
</table></td></tr>
<tr><td>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<tr>
<td nowrap> &#149; Alabama: Hey Coach</td>
<td nowrap> 
<span class="yspscores">
<a href="javascript:void(window.open('http://cosmos.bcst.yahoo.com/up/collegetest/?cl=10201617','playerWindow','width=793,height=608,scrollbars=no'));"  ><img border="0" src="http://l.yimg.com/a/i/us/sp/ed/ic/pay_audio_box.gif" width="16" height="12" alt="Subscription Audio"></a> </span></td>
<td nowrap>  </td>
<td width="100%" nowrap class="yspscores"> 7:00 pm EST</td>

</tr>
</table></td></tr>
</table>

Need help.

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/136078-solved-parsing-between/
Share on other sites

I could finally write the code to get content between <table...>......</table> :

 

$patterns = ' width="100%" style="border-collapse: collapse" bordercolor="#111111"';

$html = str_replace($patterns, "", $html);

 

preg_match_all('~class="ysprow1">(.*)~is',$html,$matches);

 

print_r($matches);

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.