PHP code example of s37dap42x / yandex-rich-content-api

1. Go to this page and download the library: Download s37dap42x/yandex-rich-content-api 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/ */

    

s37dap42x / yandex-rich-content-api example snippets


use Yandex\RichContentAPI\RichContent;

$key = "rca.1.1...";
$url = "http://yandex.com";

try {
    $yandex = new RichContent($key);

    // Set optional parameters
    $yandex->setOptions(['img' => 'no', 'content' => 'full']);

    $data = $yandex->getContent($url);
    var_dump($data); // object
} catch (Exception $e) {
    echo $e->getMessage();
}