$html = 'Nowy<br/><br/>tekst|Stary tekst';
$html = strstr( preg_replace('/(<br *\/*>)+/', '<br>',
strip_tags( $html, '<b><br>')), '|', true);
23 maj 2016
$html = 'Nowy<br/><br/>tekst|Stary tekst';
$html = strstr( preg_replace('/(<br *\/*>)+/', '<br>',
strip_tags( $html, '<b><br>')), '|', true);
$desc="Lublin, mapa Zamkowa
dziedziniec Zamku";
$desc=preg_replace('/[\r\t ]+/',' ',$desc);
echo $desc;
Usunięcie tagów html z tekstu
$art_text = preg_replace("/(align|class|style|clear)\=\"([^\"]*)\"/", '', $art_text);
$art_text = strip_tags($art_text, '<p><br><strong><b><em><u><strike>');
echo $art_text;
<?
$task='nowe';
function ob_callback($data) {
global $task;
return preg_replace("/\[\]/",'['.$task.']', $data);
}
ob_start('ob_callback');
? >
[]
1111
[]
22221
[]
1
65555
< ? ob_end_flush(); ? >
Wynik działania:
[nowe]
1111
[nowe]
22221
[nowe]
1 65555
function curlRequest($url) {
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$httpHeader = array(
"Content-Type: text/xml; charset=UTF-8",
"Content-Encoding: UTF-8"
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeader);
$data=curl_exec($ch);
$info=curl_getinfo($ch);
$errno=curl_getinfo( $ch, CURLINFO_HTTP_CODE );
$finalurl=curl_getinfo( $ch, CURLINFO_EFFECTIVE_URL );
curl_close($ch);
if(preg_replace("/\/$/", "", $finalurl)==preg_replace("/\/$/", "", $url))
$finalurl = ";
return $errno.'|'.$finalurl;
}
$urls = 'www.wolakorybutowa.pl';
$tab_urls = preg_split('//', $urls, -1, PREG_SPLIT_OFFSET_CAPTURE);
for($i=0; $i $data = curlRequest('http://'.trim(chop($tab_urls[$i][0])));
$tab_urls[$i][1] = $data;
}
print_r($tab_urls);