Documention for: reads.r
Created by: sergey
on: 8-Jul-2024
Format: html
Downloaded on: 30-Apr-2025
This function allows you to receive files from the network/Internet
using modern versions of the SSL/TSL protocols.
The standard functions return an error:
>> read https://microsoft.com
** Command Error: SSL Error: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1
alert protocol version
** Where: build-port
** Near: system/words/set-modes port/sub-port [secure: true]
This function allows you to get the contents of a file without errors:
>> reads https://microsoft.com
== {
<!DOCTYPE html><html xmlns:mscom="http://schemas.microsoft.com/CMSvNext"
xmlns:md="http://schemas.microsoft.com/mscom-...
The work is carried out by means of a PHP script, which can be accessed
via the HTTP or HTTPS/TLS-1 protocol. Having received the address,
the script downloads the file using CURL and modern versions of encryption
protocols. After downloading, it returns its contents.
PHP script code:
<?php
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // do not return headers
CURLOPT_FOLLOWLOCATION => true, // follow redirects
CURLOPT_USERAGENT => "Rebol", // who am i
CURLOPT_AUTOREFERER => true, // set referer on redirect
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
CURLOPT_TIMEOUT => 120, // timeout on response
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
);
$ch = curl_init( $_GET['q'] );
curl_setopt_array( $ch, $options );
$content = curl_exec( $ch );
$err = curl_errno( $ch );
$errmsg = curl_error( $ch );
$header = curl_getinfo( $ch );
curl_close( $ch );
echo $content;
?>