
Today I will show you how to fetch facebook Open Graph (OG) meta tags with php script. Open Graph meta tags are used in html page of website to generate previews of content. When your page is shared on facebook it will capture the og meta tags and generate the snippet. Meta tags are added inside the head tag.
The core Open Graph tags Facebook reads when generating a link preview are:
As an example, the following is the Open Graph protocol:
<html prefix="og: http://ogp.me/ns#">
<head>
<meta property="og:title" content="Post title" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://postrss.com" />
<meta property="og:image" content="https://postrss.com/wp-content/uploads/2014/01/mainslide1.jpg" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
...
</head>
...
</html>Note: og:type must be a value from Facebook’s approved list — common choices are website, article, or product. Custom text like “News Site” isn’t a valid type and will be ignored by Facebook’s parser.
Adding an og:image tag alone doesn’t guarantee the large thumbnail layout — Facebook decides between a large image card and a small square thumbnail based on your image’s dimensions and aspect ratio. To reliably get the large format:
og:image:width e og:image:height tags so Facebook’s crawler doesn’t have to download the image just to measure it.Facebook caches the OG data it reads for a URL, so if you change your tags after the page has already been shared once, the old preview can keep showing. Use the Facebook Sharing Debugger to paste in your URL, see exactly which OG tags Facebook detected, and force it to re-scrape the page for an updated preview.
When PostRSS auto-posts a new article from your RSS feed to Facebook, it relies on your page’s own OG tags (or the image embedded in your feed item) to determine the thumbnail shown. Setting up correct og:image, og:image:width, and og:image:height tags on your website — using the guidance above — is what ensures automated posts also show the large-thumbnail format rather than a small or missing preview.
Facebook caches OG data per URL. Run the URL through the Facebook Sharing Debugger and click “Scrape Again” to force a refresh.
Facebook’s documented minimum is 200 × 200 pixels, but anything that small will only ever render as a small thumbnail, never the large-card layout.
og:image alone works, but adding the width/height tags lets Facebook’s crawler skip downloading the image to measure it, which makes your preview render faster and more reliably.
Most major platforms, including LinkedIn and Discord, read the same Open Graph tags Facebook uses, so a correctly sized og:image typically produces a good preview across all of them. X (Twitter) is the one common exception — it primarily reads its own twitter:card e twitter:image tags instead, so if you want a large image preview there too, add those tags alongside your Open Graph tags rather than relying on og:image alone.