php3-list | 2000051
Date: 05/04/00
- Next message: Richard Lynch: "Re: [PHP3] High Warning Levels"
- Previous message: darcy w. christ: "[PHP3] a list of an array of objects"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Please post directly to the list instead of emailing me: You'll get more answers faster...
You don't even need to subscribe.
$http = fopen("http://www.something.com", 'r') or die("Unable to acces web-site.");
$html = '';
while (!feof($http)){
$html .= fread($http, 4096);
}
$rows = explode('<TR>', $html);
# Note that writable means writable by 'nobody' or 'www' or 'IUSR_machinename'
# IE, by whatever user PHP runs as.
$textfile = fopen("/full/path/to/writable/directory/file", "w");
while (list(,$row) = each($rows)){
$columns = explode('<TD>', $row);
list($name, $idunno, $address, $phone, $fax) = $columns;
$name = explode('</TD>', $name);
$name = $name[0];
$idunno = explode('</TD>', $idunno);
$idunno = $idunno[0];
$address= explode('</TD>', $address);
$address= $address[0];
$phone= explode('</TD>', $phone);
$phone= $phone[0];
$fax= explode('</TD>', $fax);
$fax= $fax[0];
#You may also wish to strip out the that some crappy HTML-coder put in:
$name = str_replace(' ', '', $name);
#etc
# This will generate a tab-delimited file suitable for import into any
# software package.
fputs($textfile, "$name\t$idunno\t$address\t$phone\t$fax);
}
----- Original Message -----
From: R. Böttiger
To: ceo <email protected>
Sent: Thursday, May 04, 2000 2:24 AM
Hi to All!
I want to read a html site on the net. And the php script must catch (or better parse?) all the data
between <td> </td> to put it in a txt file. Can anyone of you help me out?
<TABLE bgColor=#cccccc border=1 cols=5 width="100%">
<TBODY>
<TR>
<TD>Gabler Joachim</TD>
<TD> </TD>
<TD>Goethestr. 5, 14163 Berlin</TD>
<TD> 030-809729-0</TD>
<TD> </TD></TR>
<TR>
<TD>Gabriel Christian</TD>
<TD> </TD>
<TD>Otto-Suhr-Allee 97, 10585 Berlin</TD>
<TD>030-3416024</TD>
<TD>030-3419042</TD></TR>
.......
- Next message: Richard Lynch: "Re: [PHP3] High Warning Levels"
- Previous message: darcy w. christ: "[PHP3] a list of an array of objects"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

