PHP code example of shweshi / opengraph

1. Go to this page and download the library: Download shweshi/opengraph library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shweshi / opengraph example snippets


  'providers' => array(
      ....
      shweshi\OpenGraph\Providers\OpenGraphProvider::class,
  ),
  

  'aliases' => array(
      ....
      'OpenGraph' => shweshi\OpenGraph\Facades\OpenGraphFacade::class
  ),
  

  $data = OpenGraph::fetch("https://unsplash.com/", true);
  

  $url = "https://ogp.me",
  $allMeta = true, // can be false
  $language = 'en' // en-US,en;q=0.8,en-GB;q=0.6,es;q=0.4
  $data = OpenGraph::fetch($url, $allMeta, $language);
  

$opg_array = OpenGraph::fetch('URL', true, null, null, 'facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)');