Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

79 users online



How to retrieve domains from table rows in an html page?

How to retrieve domains from table rows in an html page?

Currently viewing this thread: 1 (0 members and 1 guests)


Page 1 out of 2
JohnSaunders

JohnSaunders

Neverside Newbie
Status: Offline!

How to retrieve domains from table rows in an html page?

Can somebody tell me what I'm doing wrong in the following script? I'm trying to get it to print out a list of domains that are taken from the following lines of code:

PHP:

<?php
$buf 
file_get_contents("list.html");

$re "~<font face =' Arial,Verdana' size=1>&nbsp;(.*)&nbsp;</td>~si";
preg_match($re$buf$result);
print_r($result); 
?>

Here's the code that is in list.html:

PHP:

<?php
<HTML>
<
BODY>
<
table border=1 cellspacing=0 cellpadding=0>
<
tr>
<
td>
<
font face =' Arial,Verdana' size=1>
&
nbsp;domain.net&nbsp;
</
td>
<
td>
<
font face =' Arial,Verdana' size=1>
&
nbsp;Primary&nbsp;
</
td>

<
td align=center>
<
font face =' Arial,Verdana' size=1>
<
class=bob href=/dns_services_modify.asp?dnsname=domain.net><b>&nbsp;Modify&nbsp;</b></a>
</
td>

<
td align=center>
<
font face =' Arial,Verdana' size=1>
<
class=bob href=/dns_services_modify_raw.asp?dnsname=domain.net><b>&nbsp;Modify&nbsp;</b></a>
</
td>

<
td align=center>
<
font face =' Arial,Verdana' size=1>
<
class=bob href=/dns_services_delete.asp?dnsname=domain.net><b>&nbsp;Delete&nbsp;</b></a>
</
td>

<
td align=center>
<
font face =' Arial,Verdana' size=1>

<
class=bob href=/dns_services_viewzone.asp?ns=1&dnsname=domain.net><b>&nbsp;NS1&nbsp;</b></a>

-
<
class=bob href=/dns_services_viewzone.asp?ns=2&dnsname=domain.net><b>&nbsp;NS2&nbsp;</b></a>
-
<
class=bob href=/dns_services_viewzone.asp?ns=3&dnsname=domain.net><b>&nbsp;NS3&nbsp;</b></a>
</
td>
</
tr>

<
tr>
<
td>
<
font face =' Arial,Verdana' size=1>
&
nbsp;domain.com&nbsp;
</
td>
<
td>

<
font face =' Arial,Verdana' size=1>
&
nbsp;Primary&nbsp;
</
td>

<
td align=center>
<
font face =' Arial,Verdana' size=1>
<
class=bob href=/dns_services_modify.asp?dnsname=domain.com><b>&nbsp;Modify&nbsp;</b></a>
</
td>

<
td align=center>
<
font face =' Arial,Verdana' size=1>
<
class=bob href=/dns_services_modify_raw.asp?dnsname=domain.com><b>&nbsp;Modify&nbsp;</b></a>
</
td>

<
td align=center>
<
font face =' Arial,Verdana' size=1>
<
class=bob href=/dns_services_delete.asp?dnsname=domain.com><b>&nbsp;Delete&nbsp;</b></a>
</
td>

<
td align=center>
<
font face =' Arial,Verdana' size=1>

<
class=bob href=/dns_services_viewzone.asp?ns=1&dnsname=domain.com><b>&nbsp;NS1&nbsp;</b></a>
-
<
class=bob href=/dns_services_viewzone.asp?ns=2&dnsname=domain.com><b>&nbsp;NS2&nbsp;</b></a>
-
<
class=bob href=/dns_services_viewzone.asp?ns=3&dnsname=domain.com><b>&nbsp;NS3&nbsp;</b></a>

</
td>
</
tr>

<
tr>
<
td>
<
font face =' Arial,Verdana' size=1>
&
nbsp;domain.co.yu&nbsp;
</
td>
<
td>
<
font face =' Arial,Verdana' size=1>
&
nbsp;Primary&nbsp;
</
td>

<
td align=center>

<
font face =' Arial,Verdana' size=1>
<
class=bob href=/dns_services_modify.asp?dnsname=domain.co.yu><b>&nbsp;Modify&nbsp;</b></a>
</
td>

<
td align=center>
<
font face =' Arial,Verdana' size=1>
<
class=bob href=/dns_services_modify_raw.asp?dnsname=domain.co.yu><b>&nbsp;Modify&nbsp;</b></a>
</
td>

<
td align=center>
<
font face =' Arial,Verdana' size=1>
<
class=bob href=/dns_services_delete.asp?dnsname=domain.co.yu><b>&nbsp;Delete&nbsp;</b></a>
</
td>

<
td align=center>
<
font face =' Arial,Verdana' size=1>

<
class=bob href=/dns_services_viewzone.asp?ns=1&dnsname=domain.co.yu><b>&nbsp;NS1&nbsp;</b></a>
-
<
class=bob href=/dns_services_viewzone.asp?ns=2&dnsname=domain.co.yu><b>&nbsp;NS2&nbsp;</b></a>
-
<
class=bob href=/dns_services_viewzone.asp?ns=3&dnsname=domain.co.yu><b>&nbsp;NS3&nbsp;</b></a>
</
td>
</
tr>

</
table>
</
BODY>
</
HTML>
?>

___________________

Best Regards,

John Saunders

Last edited by JohnSaunders, September 14th, 2004 10:32 AM (Edited 1 times)

Stevie

Stevie

Neversidian
Status: Offline!

My regex is a little scratchy, try

PHP:

<?php
$re 
"/<font face=' Arial,Verdana' size=1>(.+?)</td>/mis";
?>

___________________

"Hey, **** YOU!"

JohnSaunders

JohnSaunders

Neverside Newbie
Status: Offline!

Thanks for the help. Here's the error I got with your modified code: Warning: Unknown modifier 't' in /Websites/domains.php on line 6

___________________

Best Regards,

John Saunders

aonic

aonic

Neversidian
Status: Offline!

$re = "/<font face=' Arial,Verdana' size=1>(.+?)<\/td\>/mis";

___________________

-Developer
-Forum Leader
-NeverNET

Last edited by aonic, September 14th, 2004 10:25 AM (Edited 1 times)

Stevie

Stevie

Neversidian
Status: Offline!

lol, i forgot to escape the the /'s

Thanks, aonic.

___________________

"Hey, **** YOU!"

aonic

aonic

Neversidian
Status: Offline!

oh, i thought the [php ] got rid of em Grin

___________________

-Developer
-Forum Leader
-NeverNET

JohnSaunders

JohnSaunders

Neverside Newbie
Status: Offline!

I tried out the changes but I couldn't get it to work. I made some additional modifications to what I thought would work but still no luck. Can somebody please test it out to see if you can get it working on your server? Maybe it's just my set up (running locally on OS X)

Quote:

$buf = file_get_contents("list.html");

$re = "/\<font face=' Arial,Verdana' size=1\>\r\n&nbsp;(.+?)&nbsp;\r\n\<\/td\>/mis";
preg_match($re, $buf, $result);
print_r($result);

There's the non breaking space code next to (.+?) in my code above but VB keeps parsing it is a space.

___________________

Best Regards,

John Saunders

JohnSaunders

JohnSaunders

Neverside Newbie
Status: Offline!

Also, I just noticed that in my list.html code that I posted a few posts back, it wasn't showing the non breaking space tag. I modified it to show as PHP so it they would show up, but now there's an additional line that's being added for each line.

___________________

Best Regards,

John Saunders

aonic

aonic

Neversidian
Status: Offline!
Code:

Array
(
[1] => Array
(
[0] => domain.net
[1] => Primary
[2] => domain.com
[3] => Primary
[4] => domain.co.yu
[5] => Primary
)

)

i got it to get that info
with:

PHP:

<pre><?php
$buf 
file_get_contents("list.html");

$re "/<font face =' Arial,Verdana' size=1>\r\n&nbsp;(.+?)&nbsp;\r\n<\/td>/mis";

preg_match_all($re$buf$result);
unset(
$result[0]);
print_r($result);
?></pre>

http://aonic.net/~list/

___________________

-Developer
-Forum Leader
-NeverNET

Last edited by aonic, September 14th, 2004 10:49 AM (Edited 1 times)

JohnSaunders

JohnSaunders

Neverside Newbie
Status: Offline!

Thanks! One more thing...can you tell me how to list them all in a row (there' currently in groups of 13) and also so it's just like:

domain.com
domain.net
domain.org

instead of in the array that shows Primary and all the other info.

___________________

Best Regards,

John Saunders

Page 1 out of 2
Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0149 seconds.