PHP code example of jaysalvat / medium-json-parser
1. Go to this page and download the library: Download jaysalvat/medium-json-parser 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/ */
jaysalvat / medium-json-parser example snippets
$url = 'https://medium.com/@jaysalvat/my-title-99dcb55001b6';
$parser = new MediumJsonParser\Parser($url);
// Path to the iFrame proxy, see below
$parser->iframeProxyPath = 'iframe.php';
// Image compression
$parser->imageQuality = 80;
// Image max size
$parser->imageWidth = 2000;
$html = $parser->html([
// Skip/keep the title and subtitle
'skip_header' => false,
// HTML or Array of HTML
'return_array' => false
]);
echo $html;
readfile('http://medium.com/media/' . $_GET['resource_id'] . '?postId=' . $_GET['post_id'] . '"');