Welcome aboard! We are happy you are here and wish you good net-raft!
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<img src='#' id="mypic" alt='net-raft.com' width='300' height='300'>
<?php
$url_og = "https://net-raft.com";
$page_content = file_get_contents("$url_og");
$doc = new DOMDocument();
$doc->loadHTML($page_content);
$meta_val = null;
foreach($doc->getElementsByTagName('meta') as $meta) {
if($meta->getAttribute('property')=='og:image'){
$meta_value = $meta->getAttribute('content');
echo'<script type="text/javascript">document.getElementById("mypic").src = "' . $meta_value . '";</script>';
}
}
?>
</body>
</html>
The most helpful PHP solutions
detect browser phpPHP Click to see more ... 4.6K 408