Hi guys, I have a HTML string which I need to parse for certain info. I have looked at preg_match but I can tget it to do what I need. I have also looked at this function http://www.justin-cook.com/wp/2006/03/31/php-parse-a-string-between-two-strings/ but it only works with single sets of tags.
Here is my string:
$html = '<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>GPRS Module Status</title>
<link rel="stylesheet" href="/style.htm" type="text/css">
</head>
<body>
<form name=emodstat action="/goform/emodstat" method=POST>
<input type=hidden name="act" value=''><H1>Results of Last Module Status Poll:</H1><H1>Outcome: Got modem status OK:</H1><H1>Time: 3 Jan 2000 20:43:35</H1><TABLE border=1>
<TR><TD>SIM status</TD><TD> READY</TD></TR><TR><TD>Signal strength</TD><TD>-81 dBm</TD></TR><TR><TD>Manufacturer</TD><TD>Novatel Wireless Incorporated</TD></TR><TR><TD>Model</TD><TD>Expedite EU870D MiniCard</TD></TR><TR><TD>IMEI</TD><TD>000000000000000</TD></TR><TR><TD>IMSI</TD><TD>234100500000000</TD></TR><TR><TD>ICCID</TD><TD>0000000500000000000</TD></TR><TR><TD>Firmware</TD><TD>10.9.00.0-00 [2007-02-09 15:06:02]</TD></TR><TR><TD>GPRS Attachment Status</TD><TD>Attached</TD></TR><TR><TD>GPRS Registration</TD><TD>Registered, home network</TD></TR><TR><TD>GSM Registration</TD><TD>Registered, home network</TD></TR><TR><TD>Network</TD><TD> 0,0,"SomeNet,0</TD></TR><TR><TD>Service Provider Name</TD><TD> "SomeNet"</TD></TR><TR><TD>Radio Access Technology</TD><TD>Auto,CS+PS,GSM CS+PS</TD></TR><TR><TD>Network Technology</TD><TD>EDGE</TD></TR><TR><TD>Cell Information</TD><TD> lac:0007 ci:1514</TD></TR><TR><TD>Connection Status</TD><TD> 0</TD></TR></TABLE>
<p>Click the refresh button to get the current status.</p><input type=submit name=state value="Refresh">
<p>Click the scan button to scan for available networks.</p><input type=submit name=state value="Scan">
<p>Click the auto button to unlock all network preferences.</p><input type=submit name=pbut value="Auto" onClick="emodstat.act.value=auto">
</form>
</body>
</html>';
What I need it to be able to get the variables:
// Signal Strength
$signal = "-81";
// GPRS Attachment Status
$gprs_attach_status = "Attached";
// GPRS Registration
$gprs_reg = "Registered, home network";
// Service Provider Name
$provider_name = "SomeNet";
Thanks for any help...