Code inside Function is working, but as i want to process more then one Url i wanted to make it a function using a array to get the urls to process. Here is the Code:
<?php
$site = array("http://www.ihr-apotheker.de/cs1.html", "http://www.ihr-apotheker.de/cs2.html", "http://www.ihr-apotheker.de/cs3.html");
function parseNAI($sites)
{
foreach ($sites as $html)
{
$clean_one = strstr($html, '<p>');
$clean_one_class = str_replace('<p><span class="headline">', '<p class="headline gruen"><span>', $clean_one);
$clean_one_class_a = strip_tags($clean_one_class, '<p><span><a>');
$clean_one_class_b = preg_replace("/\s+/", " ", $clean_one_class_a);
$str_one = preg_replace('#(<a.*>).*?(</a>)#', '$1$2', $clean_one_class_b);
$ausgabe_one = strip_tags($str_one, '<p>');
echo $ausgabe_one;
}
};
parseNAI($site);
?>
Where is my problem as the function stops working at the beginning of the foreach….
Thx in advance for your help!
I have a feeling you are missing a step in there… maybe a
file_get_contentsor the like? Right now you are running a bunch of string functions on the uri themselves, not the source at the uri.Try this instead: