The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
am new to php and needed help in parsing some html code from an external webpage (with consent from owner)
and outputing it on the index.php of vB. Not parsing the whole webpage though just some of it. Any anyone help? |
#2
|
||||
|
||||
post the code here.... you'll get much more response... if the code is too big then post the problem area.
|
#3
|
||||
|
||||
This will involve pattern matching. You'll need to know what's before and after the text you want.
If you want to read docs on some of the functions you might use... eregi(), file(), preg_match() |
#4
|
||||
|
||||
Quote:
I know nothing about PHP, am still learning. If it's the HTML code, yes I can paste it here. |
#5
|
||||
|
||||
This is the HTML from the site I want to parse
<TABLE WIDTH="70%" > <TR> <TD><FONT SIZE=+1><a name="patch">Patch Server:</a></FONT></TD> <TD><IMG SRC="http://ultima.lightning.net/uo/img/grnball.gif" HEIGHT=17 WIDTH=17 ALIGN=TOP> UP! for 57h 20m 06s</TD> </TR> <TR> <TD><FONT SIZE=+1><a name="login">Login Server:</a></FONT></TD> <TD><IMG SRC="http://ultima.lightning.net/uo/img/grnball.gif" HEIGHT=17 WIDTH=17 ALIGN=TOP> UP! for 97h 49m 06s</TD> </TR> <TD><FONT SIZE=+1><a name="AOLLegends">AOL Legends:</a></FONT></TD> <TD><IMG SRC="http://ultima.lightning.net/uo/img/grnball.gif" HEIGHT=17 WIDTH=17 ALIGN=TOP> UP! for 1h 31m 06s <A HREF="http://ultima.lightning.net/uo/en/history/AOLLegends.html"><FONT SIZE="-2">[details]</FONT></a></TD> </TR> Note that I only need to parse some of it not the whole HTML so some stripping need to be done. i.e I only need to parse the code I highlighted in red above. The page that I'm parsing the HTML from refreshed every 60 secs. |
#6
|
||||
|
||||
As Mark already mentioned try looking into eregi(), file(), preg_match() on php.net and i'm pretty sure there are a few scripts that do something like this... you could try and look them up at hotscripts.com and look at the source and get an idea from there.
|
#7
|
||||
|
||||
Ok thanks
|
#8
|
||||
|
||||
What you'll be doing is pattern matching. So, you have to know what is surrounding the text you want.
Do you only want the those two pairs in red? Or, do you want anything in this pattern: <TR> <TD><FONT SIZE=+1><a name="login">TEXT TEXT TEXT</a></FONT></TD> <TD>TEXT TEXT TEXT HEIGHT=17 WIDTH=17 ALIGN=TOP> UP! for 97h 49m 06s</TD> </TR> When your pattern matching, you want to be very specific. |
#9
|
||||
|
||||
I just want the 2 pair in red.
In total there's about 14 pairs of that on that page. But output differently on my page, I'll want to replace his image file with my own image file. But i need to know which image file is on his page at that time cos there's 2 type, a grnball.gif and a redball.gif I'll name mine the same too, but will be of different pic. Thanks for replying Mark. |
#10
|
||||
|
||||
Wait.. do you want only those 2 pairs (login server, aol legends), or all 14 pairs? (I'm looking at pairs as the text and image)
Some "Quickie Code" (untested) PHP Code:
Good Luck, |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|