I am trying to check if a gravitator exists. When I try the approach recommended in earlier questions, I get the error message "Warning: get_headers () [function.get-headers]: This function can only be used for URLs" Has anyone seen this or seen an error in my code? PS I do not want to specify the default image for gravatar, since there can be more than one default option if the gravitator does not come out.
Also, I found a link to an error, possibly related to my ini file, which I don’t think my host gives me access to. If so, is there an alternative to getheaders? Many thanks.
$email = $_SESSION['email'];
$email= "person@gmail.com";
$gravemail = md5( strtolower( trim( $email ) ) );
$gravsrc = "http://www.gravatar.com/avatar/".$gravemail;
$gravcheck = "http://www.gravatar.com/avatar/".$gravemail."?d=404";
$response = get_headers('$gravcheck');
echo $response;
exit;
if ($response != "404 Not Found"..or whatever based on response above){
$img = $gravsrc;
}
source
share