Jump to content

preg_match runs very well - need to do only a bit more... [tipp needed]


dilbertone

Recommended Posts

Hello dear Community,

 

i need some help with preg_match - i want to optimize the code that allready runs very well!  i want to get ony the results  - not the overhead of HTML-tags in the result

 

How can i improve the (allready very nice ) code!?

 

 

<?php

$content = file_get_contents("http://schulnetz.nibis.de/db/schulen/schule.php?schulnr=94468&lschb");

var_dump($content);

$pattern = '/<td>(.*?)<\/td>/si';
preg_match_all($pattern,$content,$matches);

foreach ($matches[1] as $match) {
    $match = strip_tags($match);
    $match = trim($match);
    var_dump($match);
}

?>

 

 

Note: I want to store the results in a database - how to do that!?

 

Each idea and tipp will be greatly appreciated

regards

 

db1

preg_match_all($pattern, $content, $matches);
$matches = array_map('trim', array_map('striptags', $matches[1]));

 

There are plenty of mysql and other PHP turtorials:  http://lmgtfy.com/?q=php+mysql+tutorial

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.