this works, it echoes "worked".

<?php

$url = "http://www.realgm.com";

$tags = (get_meta_tags($url)) ? get_meta_tags($url) : false;

if($tags){
 echo "worked";
}else{
echo "failed";
}
?>

i've deliberately done this so it doesn't work. It fails to open stream. How do i make the error message invisible?... it should just say "failed".

<?php

$url = "gssgdd";

$tags = (get_meta_tags($url)) ? get_meta_tags($url) : false;

if($tags){
 echo "worked";
}else{
echo "failed";
}
?>

Recommended Answers

All 2 Replies

Just add

<?php
if (ini_get('display_errors') == 1) {
    ini_set('display_errors', 0);
}
?>

to the start of the file. That will turn of error display

or if you didn't want to change your php.ini (i don't think you should)

use the @ sign

<?php

$url = "gssgdd";

@$tags = (get_meta_tags($url)) ? get_meta_tags($url) : false;

if($tags){
 echo "worked";
}else{
echo "failed";
}
?>
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.