I have tried:

$urlres = preg_match_all('#<img[^>]*?>#si', $site, $matches);
$checkhttp = preg_match('#src="http#si', $matches[0][$i], $checked);

if ($urlres = true) {for($i = 0, $size = sizeof($matches[0]); $i < $size; ++$i)
					{
					
					if ($checkhttp != true):
					$pattern = '#src="http:#';
					$replacement = 'src="';
					$replacement .= $link2;
					$string = $matches[0][$i];
					$result = preg_replace($pattern, $replacement, $string);
					echo $string;
					else:
					echo $matches[0][$i];				
					endif;
					
					
					

}
					}

can someone help me please

Recommended Answers

All 2 Replies

I'm not too sure as to what the second line should be but the first line should look as follows:

$urlres = preg_match_all('/<img[^>]+\>/i', $site, $matches);

I don't know where you got the "#s"s from, but you should replace those with a "/" like cwarn23 suggested. Doesn't PHP give you an error on your regexp lines?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.