
Quote from luishp on November 27, 2020, 12:04 pmAfter reading this interesting article, I have tested this free proxy to avoid CORS while loading external site text content from VisualNEO Web apps and it works really well.
For example if you want to get the HTML code from google.es and store it in a variable this won't work:
FileToVar "https://google.es" [MyVar]But if you use this instead, it will work:
FileToVar "https://cors-anywhere.herokuapp.com/https://google.es" [MyVar]Just prepend the proxy url to the url you want to load into the variable.
This will work with any .txt, .json, .xml file or while trying to connect to an API.I'm now searching on how to create our own proxy using a .php script.
I hope you will find this as useful as I do :)
UPDATE 21/02/25: This free proxy doesn't work anymore. Please read below for alternatives.
After reading this interesting article, I have tested this free proxy to avoid CORS while loading external site text content from VisualNEO Web apps and it works really well.
For example if you want to get the HTML code from google.es and store it in a variable this won't work:
FileToVar "https://google.es" [MyVar]
But if you use this instead, it will work:
FileToVar "https://cors-anywhere.herokuapp.com/https://google.es" [MyVar]
Just prepend the proxy url to the url you want to load into the variable.
This will work with any .txt, .json, .xml file or while trying to connect to an API.
I'm now searching on how to create our own proxy using a .php script.
I hope you will find this as useful as I do :)
UPDATE 21/02/25: This free proxy doesn't work anymore. Please read below for alternatives.
Uploaded files:


Quote from luishp on November 27, 2020, 8:21 pmWelcome back @asmat :)
This is a very simple PHP proxy script:
<?php header("Access-Control-Allow-Origin: *"); $url = (isset($_GET['url'])) ? $_GET['url'] : false; if(!$url) exit; set_error_handler("warning_handler", E_WARNING); //header('Content-Type: text/html'); //uncomment this to send auth creds $string = file_get_contents($url, false); echo $string; restore_error_handler(); function warning_handler($errno, $errstr) { header('Content-Type: text/plain'); echo $errstr; } exit; ?>I have installed a copy in this server (don't use it for production, just for testing). Usage:
FileToVar "https://visualneo.com/proxy/?url=https://google.es" [MyVar]This open up a lot of possibilities for web scrapping :)
More to come.Regards.
Welcome back @asmat :)
This is a very simple PHP proxy script:
<?php
header("Access-Control-Allow-Origin: *");
$url = (isset($_GET['url'])) ? $_GET['url'] : false;
if(!$url) exit;
set_error_handler("warning_handler", E_WARNING);
//header('Content-Type: text/html'); //uncomment this to send auth creds
$string = file_get_contents($url, false);
echo $string;
restore_error_handler();
function warning_handler($errno, $errstr) {
header('Content-Type: text/plain');
echo $errstr;
}
exit;
?>
I have installed a copy in this server (don't use it for production, just for testing). Usage:
FileToVar "https://visualneo.com/proxy/?url=https://google.es" [MyVar]
This open up a lot of possibilities for web scrapping :)
More to come.
Regards.

Quote from farhad2008 on November 27, 2020, 11:20 pmVery Good and Thank you luishp
Very Good and Thank you luishp
Quote from Gaev on November 28, 2020, 3:52 am@luishp
This worked on a text file on my (http) website .. from my VisualNEOWeb App resident on my C: drive.
It will make testing Apps that 'dynamically load plain text, HTML text/templates, Listbox items and JSON key:value pairs' a lot quicker.
Just remember that FileToVar is an asynchronous process ... when I followed this command with an AlertBox, I kept getting 'undefined' for the variable ... so it should be used in conjunction with the OnLoadSuccess and OnLoadError commands.
Thanks.
This worked on a text file on my (http) website .. from my VisualNEOWeb App resident on my C: drive.
It will make testing Apps that 'dynamically load plain text, HTML text/templates, Listbox items and JSON key:value pairs' a lot quicker.
Just remember that FileToVar is an asynchronous process ... when I followed this command with an AlertBox, I kept getting 'undefined' for the variable ... so it should be used in conjunction with the OnLoadSuccess and OnLoadError commands.
Thanks.

Quote from joferar333 on June 6, 2023, 9:58 am@luishp
Por favor me puedes indicar como debo hacer para poder instalar tu pequeño script de proxy en mi servidor.
Que nombre debe tener ese archivo php que muestras en el script?
cual es la ruta que deberia estar en mi servidor (https://globaldima.com....)
Desde ya un millon de gracias
Por favor me puedes indicar como debo hacer para poder instalar tu pequeño script de proxy en mi servidor.
Que nombre debe tener ese archivo php que muestras en el script?
cual es la ruta que deberia estar en mi servidor (https://globaldima.com....)
Desde ya un millon de gracias

Quote from luishp on June 6, 2023, 12:47 pm@joferar333 el nombre que tu quieras, por ejemplo "proxy.php" (yo lo he llamado index.php para que sea el que el servidor coge por defecto en la carpeta). Solo recuerda el nombre que le has dado para poderlo invocar después en la URL.
La ruta, la que tu quieras. Puedes subirlo al directorio raíz, a una carpeta, a un subdominio o donde prefieras.Ejemplo:
FileToVar "https://globaldima.com/proxy.php?url=https://google.es" [MyVar]
@joferar333 el nombre que tu quieras, por ejemplo "proxy.php" (yo lo he llamado index.php para que sea el que el servidor coge por defecto en la carpeta). Solo recuerda el nombre que le has dado para poderlo invocar después en la URL.
La ruta, la que tu quieras. Puedes subirlo al directorio raíz, a una carpeta, a un subdominio o donde prefieras.
Ejemplo:
FileToVar "https://globaldima.com/proxy.php?url=https://google.es" [MyVar]