Jump to content

Find Tag Name after finding a string


Recommended Posts

:confused:

Hi guys, I am trying to do a script which fetches the source code of a webpage, say : http://www.abc.com/shop.html, then looks for an element in the source code, say BO_TRAN in the following:

 

tr align=left bgcolor="#F5F5DC">

<td valign=top colspan=1><font face="verdana, arial, helvetica" size="-2">BO_TRAN</font>

</td>

<td valign=top colspan=1><font face="verdana, arial, helvetica" size="-2">Loader</font>

</td>

<td valign=top colspan=1><font face="verdana, arial, helvetica" size="-2">n/a</font>

 

</td>

<td valign=top colspan=1><font face="verdana, arial, helvetica" size="-2">Batchprocess</font>

</td>

<td valign=top colspan=1><font face="verdana, arial, helvetica" size="-2">n/a</font>

</td>

<td style=white-space:nowrap colspan=1><font face="verdana, arial, helvetica" size="-2">2011-05-12 08:43:57 SGT</font>

</td>

</tr>

 

then returns the value of the date as a variable.

Link to comment
https://forums.phpfreaks.com/topic/241386-find-tag-name-after-finding-a-string/
Share on other sites

How to fetch the date in the code i posted after the BO_TRAN String

 

Basically I need to get this part:

<td style=white-space:nowrap colspan=1><font face="verdana, arial, helvetica" size="-2">2011-05-12 08:43:57 SGT</font>

 

and store the date (2011-05-12 08:43:57 SGT) into a variable.

 

So basically, I need to find the tag where the innerHTML BO_TRAN is located and then store the date from below it to a variable.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.