Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Mar 2000
Posts: 528
Junior Member
Junior Member
Offline
Joined: Mar 2000
Posts: 528
I figure there are much smarter PHP dudes out here than I am, and cannot figure this one out by myself (yet!). I have an HTML table I have stripped down to get rid of a bunch of unwanted code, and am left with this:

http://www.bladekeep.com/tmp/ps3.dat

Is there a way to grab only the following information out of the HTML code?

Medar
Test Server1
2
17
Lead Manager
17721
177
944
N/A
988
1932
June 1, 2004

I have tried parsing it looking for identifier tags, but cannot get it to work properly. I also tried displaying lines...

Code
$lines = file('ps3.dat'); <br />print $lines[407]; <br />print $lines[408]; <br />print $lines[410];
etc etc...but that did not work either, as it grabbed part of the HTML instead of just the data.

What I am doing, is pulling this off one of my sites that a family member admins, and storing it in a database on a separate site that I admin.

Thanks for any suggestions on functions, etc! I have never tried parsing anything before.

Sponsored Links
Joined: Sep 2003
Posts: 803
Coder
Coder
Offline
Joined: Sep 2003
Posts: 803
Are you looking for it to stay in the same layout as the link but with only that information?

or do you want it to display like this,
Medar
Test Server1
2
17
Lead Manager
17721
177
944
N/A
988
1932
June 1, 2004

EDIT:
nevermind me. I totally misunderstood your post. I was thinking that you wanted to keep it the way it is, just to remove the "titles" you need code to pull that info and getting only the parts you need. lol dont mind me...

Last edited by DrChaos; 06/03/2004 11:09 AM.
Joined: Oct 2003
Posts: 2,305
Old Hand
Old Hand
Joined: Oct 2003
Posts: 2,305
yes there is.

Joined: Oct 2003
Posts: 2,305
Old Hand
Old Hand
Joined: Oct 2003
Posts: 2,305
try this and tweak it til its right but this should work

Code
 <br />$html = file('ps3.dat'); <br /> <br />if(preg_match("/Name:<\/span>.*<br>/i",$html, $matches1)){ <br />	$name = str_replace("<br>","",substr($matches1[0],5)); <br />} <br />if(preg_match("/Server:<\/span>.*<br>/i",$html, $matches2)){ <br />	$server = str_replace("<br>","",substr($matches2[0], 7)); <br />} <br />if(preg_match("/Access Level:<\/span>.*<br>/i",$html, $matches3)){ <br />	$alevel = substr($matches3[0], 13); <br />} <br />if(preg_match("/Restriction:<\/span>.*<br>/i",$html, $matches4)){ <br />	$restriction = substr($matches4[0], 12); <br />} <br />if(preg_match("/Title:<\/span>.*<br>/i",$html, $matches5)){ <br />	$title = substr($matches5[0], 6); <br />} <br />if(preg_match("/Points Earned<\/a>:<\/span>.*<br>/i",$html, $matches6)){ <br />	$points = substr($matches6[0], 18); <br />} <br />if(preg_match("/Number of Projects: <\/span>.*<\/p>/i",$html, $matches7)){ <br />	$projects = substr($matches7[0], 19); <br />} <br />if(preg_match("/Last Accessed on:<\/span>.*<\/p>/i",$html, $matches8)){ <br />	$lastaccess = substr($matches8[0], 24); <br />} <br />if(preg_match_all("/<td align=\"center\" class=\"cellclear\"><strong>.*<\/strong><\/td>/i",$html, $matches9)){ <br />	for ($getnumbr=0;$getnumbr<sizeof($matches9[0]);$getnumbr++) <br />		{ <br />		$numbr[] = substr($matches9[0][$getnumbr], 45); <br />		} <br />} <br /> <br />

Joined: Mar 2000
Posts: 528
Junior Member
Junior Member
Offline
Joined: Mar 2000
Posts: 528
I got it working with a bunch if EREGI calls...going to try using the preg_match calls you have in here.

Sponsored Links
Joined: Oct 2003
Posts: 2,305
Old Hand
Old Hand
Joined: Oct 2003
Posts: 2,305
eregi and preg similiar animals


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)