I am trying to select a particular part of a html page using 'Simple HTML DOM Parser'.
My code so far works but it returns the complete text which is great, but I only want to display the single P BARCODE[pb]
line.
My (working) PHP code is as follows;
$homepage = file_get_html('http://example.com/SomeTextPage');
foreach($homepage->find('text') as $element)
echo $element->innertext . '<br>'; // line 29
This returns the following on my page (this is the view source display);
<HTML>
<BODY>
EXP DATE[p43]=12-31-97<BR>
PCODE1[p44]=-<BR>
PCODE2[p45]=-<BR>
PCODE3[p46]=0<BR>
P TYPE[p47]=1<BR>
TOT CHKOUT[p48]=56<BR>
TOT RENWAL[p49]=17<BR>
CUR CHKOUT[p50]=3<BR>
HOME LIBR[p53]=0000<BR>
PMESSAGE[p54]=<BR>
MBLOCK[p56]=-<BR>
REC TYPE[p80]=p<BR>
RECORD #[p81]=110220<BR>
REC LENG[p82]=1126<BR>
CREATED[p83]=01-09-97<BR>
UPDATED[p84]=06-05-97<BR>
REVISIONS[p85]=139<BR>
AGENCY[p86]=1<BR>
CL RTRND[p95]=0<BR>
MONEY OWED[p96]=$1.35<BR>
BLK UNTIL[p101]= - - <BR>
CUR ITEMA[p102]=0<BR>
CUR ITEMB[p103]=0<BR>
PIUSE[p104]=0<BR>
OD PENALTY[p105]=0<BR>
ILL CHKOUT[p122]=3<BR>
PATRN NAME[pn]=Jackson, Richard<BR>
ADDRESS[pa]=322 San Diego St<BR>
ADDRESS2[ph]=El Cerrito, CA 99999<BR>
TELEPHONE[pt]=510-555-1212<BR>
UNIV ID[pu]=111111111<BR>
P BARCODE[pb]=21913000482538<BR>
</BODY>
</HTML>
I suppose I need to select the 32nd <br>
line or more importantly the [P BARCODE[pb]]
line - is this possible?
The [P BARCODE[pb]]
line isn't always the 32nd line, but the [P BARCODE[pb]]
text never changes.
Perhaps I am approaching this the wrong way?
Any help or suggestions are welcome.