Hallo Forum.
bin auf der Suche nach einer passenden Lösung. Habe hier 35.000 Html-Fles und möchte einen bestimmten Eintrag auslesen und diese dann in eine csv speichern.
Der Bereich ist dieser:
Das Script habe verwende ich dafür:
Das Ergebnis ist noch nicht so pralle:
Also meine PHP Kenntnisse sind Anfänger
.
Ich hoffe ihr könnt mir etwas weiterhelfen. Danke
bin auf der Suche nach einer passenden Lösung. Habe hier 35.000 Html-Fles und möchte einen bestimmten Eintrag auslesen und diese dann in eine csv speichern.
Der Bereich ist dieser:
HTML:
<table width="450" border="0" cellpadding="0" cellspacing="0">
<tbody><tr valign="top">
<td class="row1" align="left"><strong>Trinkglas 66105</strong> <br><textarea cols="86" rows="6" class="readonly2" readonly="readonly">Kindergeschirr „Playmobil“
• Lebensmittelecht
• Spülmaschinengeeignet
• Acryl
• Ø x H: 5 x 10,5 cm
• 0,225 Liter</textarea>
</td>
</tr>
</tbody></table>
Das Script habe verwende ich dafür:
PHP:
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
$host = "http://localhost/klemz/artikel/488145.html";
$filestring = file_get_contents($host);
$startpos = 0;
while($pos = strpos($filestring, '<td class="row1" align="left">', $startpos))
{
$string = substr($filestring, $pos, strpos($filestring, '<td valign="top">', $pos + 1) - $pos);
$reg = '#<strong>(.+)<\/strong>\s*<br>\s*(<textarea cols="86" rows="6" class="readonly2" readonly="readonly">(.+)<\/textarea>\s*)?#';
preg_match_all($reg, $string, $content);
echo '<pre>', var_dump($content, true), '</pre>';
$startpos = $pos +1;
}
?>
Das Ergebnis ist noch nicht so pralle:
HTML:
array(4) {
[0]=>
array(1) {
[0]=>
string(41) "Trinkglas 66105
"
}
[1]=>
array(1) {
[0]=>
string(15) "Trinkglas 66105"
}
[2]=>
array(1) {
[0]=>
string(0) ""
}
[3]=>
array(1) {
[0]=>
string(0) ""
}
}
bool(true)
array(4) {
[0]=>
array(0) {
}
[1]=>
array(0) {
}
[2]=>
array(0) {
}
[3]=>
array(0) {
}
}
bool(true)
Also meine PHP Kenntnisse sind Anfänger

Ich hoffe ihr könnt mir etwas weiterhelfen. Danke