diff --git a/.DS_Store b/.DS_Store index 18de60d..a4ea57b 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/about.php b/about.php index b6f43c1..76517b3 100644 --- a/about.php +++ b/about.php @@ -4,30 +4,45 @@ - - FrogFind! - - + FrogFind! + + + + + + +
+ + Frog + Find! + Leap again: +


-

What in the world is FrogFind?

- A quick FAQ on an unconventional search engine +

What in the world is FrogFind?

+ A quick FAQ on an unconventional search engine

Who made FrogFind?

Hi, I'm Sean, A.K.A. Action Retro on YouTube. I work on a lot of 80's and 90's Macs (and other vintage machines), and I really like to try and get them online. However, the modern internet is not kind to old machines, which generally cannot handle the complicated javascript, CSS, and encryption that modern sites have. However, they can browse basic websites just fine. So I decided to see how much of the internet I could turn into basic websites, so that old machines can browse the modern internet once again!

How does FrogFind work?

- The search functionality of FrogFind is basically a custom wrapper for DuckDuckGo search, converting the results to extremely basic HTML that old browsers can read. When clicking through to pages from search results, those pages are processed through a PHP port of Mozilla's Readability, which is what powers Firefox's reader mode. I then further strip down the results to be as basic HTML as possible. + The search functionality of FrogFind is basically a custom wrapper for DuckDuckGo search, converting the results to extremely basic HTML that old browsers can read. When clicking through to pages from search results, those pages are processed through a PHP port of Mozilla's Readability, which is what powers Firefox's reader mode. I then further strip down the results to be as basic HTML as possible.

What machines do you test FrogFind on?

I designed FrogFind with classic Macs in mind, so I've been testing on my SE/30 to make sure it looks good in 1 bit color with a 512x384 resolution. Most of my testing has been on Netscape 1.1N and 2.0.2, as well as a few 68k Mac versions of iCab. FrogFind should also work great on any text-based web browser!

How can I get in touch with you?

Send me an email! actionretro@pm.me + \ No newline at end of file diff --git a/composer.lock b/composer.lock index 77fb928..4d49e07 100644 --- a/composer.lock +++ b/composer.lock @@ -8,30 +8,30 @@ "packages": [ { "name": "fivefilters/readability.php", - "version": "v3.1.6", + "version": "v3.3.2", "source": { "type": "git", "url": "https://github.com/fivefilters/readability.php.git", - "reference": "a00d35cb5eb14a236ba42326da9ac52c8c9f80a1" + "reference": "2cd2d3d7b24d3df9cc1dcb8919451876c693d69b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fivefilters/readability.php/zipball/a00d35cb5eb14a236ba42326da9ac52c8c9f80a1", - "reference": "a00d35cb5eb14a236ba42326da9ac52c8c9f80a1", + "url": "https://api.github.com/repos/fivefilters/readability.php/zipball/2cd2d3d7b24d3df9cc1dcb8919451876c693d69b", + "reference": "2cd2d3d7b24d3df9cc1dcb8919451876c693d69b", "shasum": "" }, "require": { "ext-dom": "*", "ext-mbstring": "*", "ext-xml": "*", - "league/uri": "~6.7.2", + "league/uri": "^7.0", "masterminds/html5": "^2.0", - "php": ">=7.4.0", + "php": ">=8.1", "psr/log": "^1.0 || ^2.0 || ^3.0" }, "require-dev": { - "monolog/monolog": "^2.3", - "phpunit/phpunit": "^9" + "monolog/monolog": "^3.0", + "phpunit/phpunit": "^10.0 || ^11.0" }, "suggest": { "monolog/monolog": "Allow logging debug information" @@ -67,59 +67,50 @@ ], "support": { "issues": "https://github.com/fivefilters/readability.php/issues", - "source": "https://github.com/fivefilters/readability.php/tree/v3.1.6" + "source": "https://github.com/fivefilters/readability.php/tree/v3.3.2" }, - "time": "2023-06-15T18:06:49+00:00" + "time": "2025-03-07T18:17:00+00:00" }, { "name": "league/uri", - "version": "6.7.2", + "version": "7.5.1", "source": { "type": "git", "url": "https://github.com/thephpleague/uri.git", - "reference": "d3b50812dd51f3fbf176344cc2981db03d10fe06" + "reference": "81fb5145d2644324614cc532b28efd0215bda430" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri/zipball/d3b50812dd51f3fbf176344cc2981db03d10fe06", - "reference": "d3b50812dd51f3fbf176344cc2981db03d10fe06", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/81fb5145d2644324614cc532b28efd0215bda430", + "reference": "81fb5145d2644324614cc532b28efd0215bda430", "shasum": "" }, "require": { - "ext-json": "*", - "league/uri-interfaces": "^2.3", - "php": "^7.4 || ^8.0", - "psr/http-message": "^1.0" + "league/uri-interfaces": "^7.5", + "php": "^8.1" }, "conflict": { "league/uri-schemes": "^1.0" }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^v3.3.2", - "nyholm/psr7": "^1.5", - "php-http/psr7-integration-tests": "^1.1", - "phpstan/phpstan": "^1.2.0", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0.0", - "phpstan/phpstan-strict-rules": "^1.1.0", - "phpunit/phpunit": "^9.5.10", - "psr/http-factory": "^1.0" - }, "suggest": { - "ext-fileinfo": "Needed to create Data URI from a filepath", - "ext-intl": "Needed to improve host validation", - "league/uri-components": "Needed to easily manipulate URI objects", - "psr/http-factory": "Needed to use the URI factory" + "ext-bcmath": "to improve IPV4 host parsing", + "ext-fileinfo": "to create Data URI from file contennts", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "jeremykendall/php-domain-parser": "to resolve Public Suffix and Top Level Domain", + "league/uri-components": "Needed to easily manipulate URI objects components", + "php-64bit": "to improve IPV4 host parsing", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.x-dev" + "dev-master": "7.x-dev" } }, "autoload": { "psr-4": { - "League\\Uri\\": "src" + "League\\Uri\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -159,8 +150,8 @@ "support": { "docs": "https://uri.thephpleague.com", "forum": "https://thephpleague.slack.com", - "issues": "https://github.com/thephpleague/uri/issues", - "source": "https://github.com/thephpleague/uri/tree/6.7.2" + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri/tree/7.5.1" }, "funding": [ { @@ -168,46 +159,44 @@ "type": "github" } ], - "time": "2022-09-13T19:50:42+00:00" + "time": "2024-12-08T08:40:02+00:00" }, { "name": "league/uri-interfaces", - "version": "2.3.0", + "version": "7.5.0", "source": { "type": "git", "url": "https://github.com/thephpleague/uri-interfaces.git", - "reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383" + "reference": "08cfc6c4f3d811584fb09c37e2849e6a7f9b0742" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/00e7e2943f76d8cb50c7dfdc2f6dee356e15e383", - "reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383", + "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/08cfc6c4f3d811584fb09c37e2849e6a7f9b0742", + "reference": "08cfc6c4f3d811584fb09c37e2849e6a7f9b0742", "shasum": "" }, "require": { - "ext-json": "*", - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.19", - "phpstan/phpstan": "^0.12.90", - "phpstan/phpstan-phpunit": "^0.12.19", - "phpstan/phpstan-strict-rules": "^0.12.9", - "phpunit/phpunit": "^8.5.15 || ^9.5" + "ext-filter": "*", + "php": "^8.1", + "psr/http-factory": "^1", + "psr/http-message": "^1.1 || ^2.0" }, "suggest": { - "ext-intl": "to use the IDNA feature", - "symfony/intl": "to use the IDNA feature via Symfony Polyfill" + "ext-bcmath": "to improve IPV4 host parsing", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "php-64bit": "to improve IPV4 host parsing", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "7.x-dev" } }, "autoload": { "psr-4": { - "League\\Uri\\": "src/" + "League\\Uri\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -221,17 +210,32 @@ "homepage": "https://nyamsprod.com" } ], - "description": "Common interface for URI representation", - "homepage": "http://github.com/thephpleague/uri-interfaces", + "description": "Common interfaces and classes for URI representation and interaction", + "homepage": "https://uri.thephpleague.com", "keywords": [ + "data-uri", + "file-uri", + "ftp", + "hostname", + "http", + "https", + "parse_str", + "parse_url", + "psr-7", + "query-string", + "querystring", "rfc3986", "rfc3987", + "rfc6570", "uri", - "url" + "url", + "ws" ], "support": { - "issues": "https://github.com/thephpleague/uri-interfaces/issues", - "source": "https://github.com/thephpleague/uri-interfaces/tree/2.3.0" + "docs": "https://uri.thephpleague.com", + "forum": "https://thephpleague.slack.com", + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri-interfaces/tree/7.5.0" }, "funding": [ { @@ -239,20 +243,20 @@ "type": "github" } ], - "time": "2021-06-28T04:27:21+00:00" + "time": "2024-12-08T08:18:47+00:00" }, { "name": "masterminds/html5", - "version": "2.8.1", + "version": "2.9.0", "source": { "type": "git", "url": "https://github.com/Masterminds/html5-php.git", - "reference": "f47dcf3c70c584de14f21143c55d9939631bc6cf" + "reference": "f5ac2c0b0a2eefca70b2ce32a5809992227e75a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/f47dcf3c70c584de14f21143c55d9939631bc6cf", - "reference": "f47dcf3c70c584de14f21143c55d9939631bc6cf", + "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/f5ac2c0b0a2eefca70b2ce32a5809992227e75a6", + "reference": "f5ac2c0b0a2eefca70b2ce32a5809992227e75a6", "shasum": "" }, "require": { @@ -260,7 +264,7 @@ "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8" + "phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8 || ^9" }, "type": "library", "extra": { @@ -304,31 +308,32 @@ ], "support": { "issues": "https://github.com/Masterminds/html5-php/issues", - "source": "https://github.com/Masterminds/html5-php/tree/2.8.1" + "source": "https://github.com/Masterminds/html5-php/tree/2.9.0" }, - "time": "2023-05-10T11:58:31+00:00" + "time": "2024-03-31T07:05:07+00:00" }, { - "name": "psr/http-message", - "version": "1.1", + "name": "psr/http-factory", + "version": "1.1.0", "source": { "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" + "url": "https://github.com/php-fig/http-factory.git", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", - "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "php": ">=7.1", + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { @@ -343,7 +348,61 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" + } + ], + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory" + }, + "time": "2024-04-15T12:06:14+00:00" + }, + { + "name": "psr/http-message", + "version": "2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for HTTP messages", @@ -357,22 +416,22 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-message/tree/1.1" + "source": "https://github.com/php-fig/http-message/tree/2.0" }, - "time": "2023-04-04T09:50:52+00:00" + "time": "2023-04-04T09:54:51+00:00" }, { "name": "psr/log", - "version": "3.0.0", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", "shasum": "" }, "require": { @@ -407,18 +466,18 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/3.0.0" + "source": "https://github.com/php-fig/log/tree/3.0.2" }, - "time": "2021-07-14T16:46:02+00:00" + "time": "2024-09-11T13:17:53+00:00" } ], "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, - "platform": [], - "platform-dev": [], - "plugin-api-version": "2.3.0" + "platform": {}, + "platform-dev": {}, + "plugin-api-version": "2.6.0" } diff --git a/image.php b/image.php index ec98e37..86a2643 100644 --- a/image.php +++ b/image.php @@ -1,41 +1,47 @@ - - - - - FrogFind Image Viewer - - - < Back to previous page + + + + + + FrogFind Image Viewer + + + + + + < Back to previous page

Viewing image:



- < Back to previous page - - \ No newline at end of file + + < Back to previous page + + + \ No newline at end of file diff --git a/image_compressed.php b/image_compressed.php index 2723029..4b49a62 100644 --- a/image_compressed.php +++ b/image_compressed.php @@ -5,14 +5,14 @@ $filetype = ""; $raw_image = NULL; //get the image url -if (isset( $_GET['i'] ) ) { - $url = $_GET[ 'i' ]; +if (isset($_GET['i'])) { + $url = $_GET['i']; } else { exit(); } //an image will start with http, anything else is sus -if (substr( $url, 0, 4 ) != "http") { +if (substr($url, 0, 4) != "http") { exit(); } @@ -31,22 +31,20 @@ $raw_imagex = imagesx($raw_image); $raw_imagey = imagesy($raw_image); if ($raw_imagex >= $raw_imagey) { - $dest_imagex = 300; - $dest_imagey = intval(($raw_imagey / $raw_imagex) * $dest_imagex); + $dest_imagex = 240; // Réduit de 300 à 240 + $dest_imagey = intval(($raw_imagey / $raw_imagex) * $dest_imagex); } else { - $dest_imagey = 200; - $dest_imagex = intval(($raw_imagex / $raw_imagey) * $dest_imagey); + $dest_imagey = 160; // Réduit de 200 à 160 + $dest_imagex = intval(($raw_imagex / $raw_imagey) * $dest_imagey); } $dest_image = imagecreatetruecolor($dest_imagex, $dest_imagey); imagecopyresampled($dest_image, $raw_image, 0, 0, 0, 0, $dest_imagex, $dest_imagey, $raw_imagex, $raw_imagey); -header('Content-type: image/' . $filetype); +header('Content-type: image/' . $filetype); if ($filetype = "jpg") { - imagejpeg($dest_image,NULL,80); //80% quality + imagejpeg($dest_image, NULL, 80); //80% quality } elseif ($filetype = "png") { - imagepng($dest_image,NULL,8); //80% compression + imagepng($dest_image, NULL, 8); //80% compression } - -?> diff --git a/index.php b/index.php index c5aa35e..1dc6a2c 100644 --- a/index.php +++ b/index.php @@ -5,29 +5,36 @@ $show_results = FALSE; $results_html = ""; $final_result_html = "
"; -if(isset( $_GET['q'])) { // if there's a search query, show the results for it +if (isset($_GET['q'])) { // if there's a search query, show the results for it $query = urlencode($_GET["q"]); $show_results = TRUE; $search_url = "https://html.duckduckgo.com/html?q=" . $query; - if(!$results_html = file_get_contents($search_url)) { + $context = stream_context_create([ + 'http' => [ + 'header' => "Cache-Control: no-cache\r\n" . + "Pragma: no-cache\r\n" . + "User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 2_0 like Mac OS X) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5A347 Safari/525.20\r\n" + ] + ]); + if (!$results_html = file_get_contents($search_url, false, $context)) { $error_text .= "Failed to get results, sorry :(
"; } - $simple_results=$results_html; - $simple_results = str_replace( 'strong>', 'b>', $simple_results ); //change to - $simple_results = str_replace( 'em>', 'i>', $simple_results ); //change to + $simple_results = $results_html; + $simple_results = str_replace('strong>', 'b>', $simple_results); //change to + $simple_results = str_replace('em>', 'i>', $simple_results); //change to $simple_results = clean_str($simple_results); $result_blocks = explode('

', $simple_results); - $total_results = count($result_blocks)-1; + $total_results = count($result_blocks) - 1; for ($x = 1; $x <= $total_results; $x++) { - if(strpos($result_blocks[$x], '')===false) { //only return non ads + if (strpos($result_blocks[$x], '') === false) { //only return non ads // result link, redirected through our proxy $result_link = explode('class="result__a" href="', $result_blocks[$x])[1]; $result_topline = explode('">', $result_link); - $result_link = str_replace( '//duckduckgo.com/l/?uddg=', '/read.php?a=', $result_topline[0]); + $result_link = str_replace('//duckduckgo.com/l/?uddg=', '/read.php?a=', $result_topline[0]); // result title - $result_title = str_replace("","",explode("\n", $result_topline[1])); + $result_title = str_replace("", "", explode("\n", $result_topline[1])); // result display url $result_display_url = explode('class="result__url"', $result_blocks[$x])[1]; $result_display_url = trim(explode("\n", $result_display_url)[1]); @@ -36,20 +43,21 @@ if(isset( $_GET['q'])) { // if there's a search query, show the results for it $result_snippet = explode('">', $result_snippet)[1]; $result_snippet = explode('', $result_snippet)[0]; - $final_result_html .= "
" . $result_title[0] . "
" - . $result_display_url . "

" . $result_snippet . "


"; + $final_result_html .= "
" . $result_title[0] . "
" + . $result_display_url . "

" . $result_snippet . "


"; } } } //replace chars that old machines probably can't handle -function clean_str($str) { - $str = str_replace( "‘", "'", $str ); - $str = str_replace( "’", "'", $str ); - $str = str_replace( "“", '"', $str ); - $str = str_replace( "”", '"', $str ); - $str = str_replace( "–", '-', $str ); - $str = str_replace( "'", "'", $str ); +function clean_str($str) +{ + $str = str_replace("‘", "'", $str); + $str = str_replace("’", "'", $str); + $str = str_replace("“", '"', $str); + $str = str_replace("”", '"', $str); + $str = str_replace("–", '-', $str); + $str = str_replace("'", "'", $str); return $str; } @@ -59,39 +67,92 @@ function clean_str($str) { + - FrogFind! + FrogFind! + + - - + -
- FrogFind! Leap again: - -
-
-
-
Search Results for
-
- - - -

FrogFind!

-

The Search Engine for Vintage Computers

-

-
-
- Leap to:
- -
-


-
Built by Action Retro on YouTube | Why build such a thing?

-
Powered by DuckDuckGo
- - + - +
+ + Frog + Find! + +
Leap again:
+ +
+ +
+
+
+
Search Results for
+
+ + + +

+
+

+ + FrogFind! + +

+
+
+

The Search Engine for Vintage Computers

+
+

+
+
+ Leap to:
+
+ +
+
+


+ +
Built by Action Retro on YouTube | Why build such a thing?

+ +
Powered by DuckDuckGo
+
+ + + + + \ No newline at end of file diff --git a/read.php b/read.php index 063f0b5..357d179 100644 --- a/read.php +++ b/read.php @@ -17,15 +17,15 @@ $compatible_content_types = [ // a direct link to the file. $proxy_download_max_filesize = 8000000; // ~ 8Mb -if( isset( $_GET['a'] ) ) { +if (isset($_GET['a'])) { $article_url = $_GET["a"]; } else { echo "What do you think you're doing... >:("; exit(); } -if (substr( $article_url, 0, 4 ) != "http") { - echo("That's not a web page :("); +if (substr($article_url, 0, 4) != "http") { + echo ("That's not a web page :("); die(); } @@ -38,8 +38,7 @@ $headers = get_headers($article_url, true, $context); if (!array_key_exists('Content-Type', $headers) || !array_key_exists('Content-Length', $headers)) { $error_text .= "Failed to get the article, its server did not return expected details :(
"; -} -else { +} else { // Attempt to handle downloads or other mime-types by passing proxying them through. if (!in_array($headers['Content-Type'], $compatible_content_types)) { $filesize = $headers['Content-Length']; @@ -49,12 +48,11 @@ else { echo 'Failed to proxy file download, it\'s too large. :(
'; echo 'You can try downloading the file directly: ' . $article_url; die(); - } - else { + } else { $contentType = $headers['Content-Type']; // Only use the last-provided content type if an array was returned (ie. when there were redirects involved) if (is_array($contentType)) { - $contentType = $contentType[count($contentType)-1]; + $contentType = $contentType[count($contentType) - 1]; } $filename = basename($url['path']); @@ -63,12 +61,12 @@ else { if (!$filename) { $filename = "download"; } - + // Set the content headers based on the file we're proxying through. header('Content-Type: ' . $contentType); header('Content-Length: ' . $filesize); // Set the content-disposition to encourage the browser to download the file. - header('Content-Disposition: attachment; filename="'. $filename . '"'); + header('Content-Disposition: attachment; filename="' . $filename . '"'); // Use readfile readfile($article_url); @@ -89,50 +87,73 @@ $configuration $readability = new Readability($configuration); -if(!$article_html = file_get_contents($article_url)) { +if (!$article_html = file_get_contents($article_url)) { $error_text .= "Failed to get the article :(
"; } try { $readability->parse($article_html); $readable_article = strip_tags($readability->getContent(), '