Jump to content

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


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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.