I would like to add an image in case a URL is present/active. Ive tried many things myself to make it work but without success.
What I want is: if url1 exist show image1 else nothing, if url2 exist show image2 else nothing, etc.
foreach ($urlsArray as $url) {
if(@fopen($url,'r')){
echo 'Exist';
}
else {
echo 'Doesnt exist';
}
}
Sorry I have to be more specific!
$urlArray = array(
'http://www.domain.com/page1.php' => 'images/image1.jpg',
'http://www.domain.com/page2.php' => 'images/image2.jpg',
etc);
foreach($urlsArray as $url){
if(@fopen($url,'r')){
echo '<img src="$image" />' /* if url1 exist show image1, etc */
}else{
echo '';
}
}
How to get this to work?
assuming that
$url = path/to/pic/pic.gif– meaning that url actually leads to a pic to be displayedupdated (use $key => $value for your foreach):