PHP code example of flatgreen / rfrance

1. Go to this page and download the library: Download flatgreen/rfrance 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/ */

    

flatgreen / rfrance example snippets



use Flatgreen\RFrance\RFrance;

$rf = new RFrance();
// optional in constructor, add a cache directory and cache duration for page, 1 day by default

$rf->extract(URL);
// optional:
// - force extract when rss exist : $force_rss (default: false)
// - set a limit $max_items (default: -1, all items)

if (empty($rf->error)){
    $title = $rf->page->title;
    $all_items = $rf->all_items; // array of Item
}

// RSS 2.0
header("Content-Type: text/xml; charset=UTF-8");
echo $FC->toRss();

// or

// youtube-dl|yt-dlp info.json like
header('Content-Type: application/json; charset=utf-8');
echo $FC->toInfoJson();